FileDocCategorySizeDatePackage
SingleNodeCounter.javaAPI DocJava SE 5 API3215Fri Aug 26 14:55:40 BST 2005com.sun.org.apache.xalan.internal.xsltc.dom

SingleNodeCounter

public abstract class SingleNodeCounter extends NodeCounter
author
Jacek Ambroziak
author
Santiago Pericas-Geertsen

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.StringgetCounter()

	int result;
	if (_value != Integer.MIN_VALUE) {
	    result = _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.NodeCountergetDefaultNodeCounter(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.NodeCountersetStartNode(int node)

	_node = node;
	_nodeType = _document.getExpandedTypeID(node);
	_countSiblings = _document.getAxisIterator(PRECEDINGSIBLING);
	return this;