SingleNodeCounterpublic abstract class SingleNodeCounter extends NodeCounter
Fields Summary |
---|
private static final int[] | EmptyArray | DTMAxisIterator | _countSiblings |
Constructors Summary |
---|
public SingleNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator)
super(translet, document, iterator);
|
Methods Summary |
---|
public java.lang.String | getCounter()
int result;
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 result = (int) _value;
}
else {
int next = _node;
result = 0;
if (!matchesCount(next)) {
while ((next = _document.getParent(next)) > END) {
if (matchesCount(next)) {
break; // found target
}
if (matchesFrom(next)) {
next = END;
break; // no target found
}
}
}
if (next != END) {
_countSiblings.setStartNode(next);
do {
if (matchesCount(next)) result++;
} while ((next = _countSiblings.next()) != END);
}
else {
// If no target found then pass the empty list
return formatNumbers(EmptyArray);
}
}
return formatNumbers(result);
| public static com.sun.org.apache.xalan.internal.xsltc.dom.NodeCounter | getDefaultNodeCounter(com.sun.org.apache.xalan.internal.xsltc.Translet translet, com.sun.org.apache.xalan.internal.xsltc.DOM document, com.sun.org.apache.xml.internal.dtm.DTMAxisIterator iterator)
return new DefaultSingleNodeCounter(translet, document, iterator);
| public com.sun.org.apache.xalan.internal.xsltc.dom.NodeCounter | setStartNode(int node)
_node = node;
_nodeType = _document.getExpandedTypeID(node);
_countSiblings = _document.getAxisIterator(Axis.PRECEDINGSIBLING);
return this;
|
|