FileDocCategorySizeDatePackage
AnyNodeCounter.javaAPI DocJava SE 6 API3619Tue Jun 10 00:22:32 BST 2008com.sun.org.apache.xalan.internal.xsltc.dom

AnyNodeCounter

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

Fields Summary
Constructors Summary
public AnyNodeCounter(Translet translet, DOM document, DTMAxisIterator iterator)

	super(translet, document, iterator);
    
Methods Summary
public java.lang.StringgetCounter()

	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 return formatNumbers((int)_value);
	}
	else {
	    int next = _node; 
            final int root = _document.getDocument();
	    result = 0;
	    while (next >= root && !matchesFrom(next)) {
		if (matchesCount(next)) {
		    ++result;	
		}
		next--;
//%HZ%:  Is this the best way of finding the root?  Is it better to check
//%HZ%:  parent(next)?
		/*
		if (next == root) {
		    break;
                }
		else {
		    --next;		
                }
                */
	    }
	}
	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 DefaultAnyNodeCounter(translet, document, iterator);
    
public com.sun.org.apache.xalan.internal.xsltc.dom.NodeCountersetStartNode(int node)

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