Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.util.IntegerArray#cardinality()

The following examples show how to use com.sun.org.apache.xalan.internal.xsltc.util.IntegerArray#cardinality() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleNodeCounter.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 2
Source File: MultipleNodeCounter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 3
Source File: MultipleNodeCounter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 4
Source File: MultipleNodeCounter.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 5
Source File: MultipleNodeCounter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 6
Source File: MultipleNodeCounter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 7
Source File: MultipleNodeCounter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 8
Source File: MultipleNodeCounter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 9
Source File: MultipleNodeCounter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 10
Source File: MultipleNodeCounter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}
 
Example 11
Source File: MultipleNodeCounter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public String getCounter() {
    if (_value != Integer.MIN_VALUE) {
        //See Errata E24
        if (_value == 0) return "0";
        else if (Double.isNaN(_value)) return "NaN";
        else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
        else if (Double.isInfinite(_value)) return "Infinity";
        else return formatNumbers((int)_value);
    }

    IntegerArray ancestors = new IntegerArray();

    // Gather all ancestors that do not match from pattern
    int next = _node;
    ancestors.add(next);            // include self
    while ((next = _document.getParent(next)) > END &&
           !matchesFrom(next)) {
        ancestors.add(next);
    }

    // Create an array of counters
    final int nAncestors = ancestors.cardinality();
    final int[] counters = new int[nAncestors];
    for (int i = 0; i < nAncestors; i++) {
        counters[i] = Integer.MIN_VALUE;
    }

    // Increment array of counters according to semantics
    for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
        final int counter = counters[j];
        final int ancestor = ancestors.at(i);

        if (matchesCount(ancestor)) {
            _precSiblings.setStartNode(ancestor);
            while ((next = _precSiblings.next()) != END) {
                if (matchesCount(next)) {
                    counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
                        : counters[j] + 1;
                }
            }
            // Count the node itself
            counters[j] = counters[j] == Integer.MIN_VALUE
                ? 1
                : counters[j] + 1;
        }
    }
    return formatNumbers(counters);
}