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

CachedNodeListIterator

public final class CachedNodeListIterator extends DTMAxisIteratorBase
CachedNodeListIterator is used for select expressions in a variable or parameter. This iterator caches all nodes in an IntegerArray. Its cloneIterator() method is overridden to return an object of ClonedNodeListIterator.

Fields Summary
private DTMAxisIterator
_source
Source for this iterator.
private IntegerArray
_nodes
private int
_numCachedNodes
private int
_index
private boolean
_isEnded
Constructors Summary
public CachedNodeListIterator(DTMAxisIterator source)


       
	_source = source;
    
Methods Summary
public com.sun.org.apache.xml.internal.dtm.DTMAxisIteratorcloneIterator()

	ClonedNodeListIterator clone = new ClonedNodeListIterator(this);
	return clone;
    
public intgetNode(int index)

        if (index < _numCachedNodes) {
            return _nodes.at(index);
        }
        else if (!_isEnded){
            int node = _source.next();
            if (node != END) {
            	_nodes.add(node);
            	_numCachedNodes++;
            }
            else {
            	_isEnded = true;
            }
            return node;
        }
        else
            return END;
    
public intgetNodeByPosition(int pos)

    	return getNode(pos);
    
public intgetPosition()

    	return _index == 0 ? 1 : _index;
    
public voidgotoMark()

	_source.gotoMark();
    
public intnext()

        return getNode(_index++);
    
public com.sun.org.apache.xml.internal.dtm.DTMAxisIteratorreset()

    	_index = 0;
    	return this;
    
public voidsetMark()

	_source.setMark();
    
public voidsetRestartable(boolean isRestartable)

	//_isRestartable = isRestartable;
	//_source.setRestartable(isRestartable);
    
public com.sun.org.apache.xml.internal.dtm.DTMAxisIteratorsetStartNode(int node)

	if (_isRestartable) {
	    _startNode = node;
	    _source.setStartNode(node);
	    resetPosition();
	    
	    _isRestartable = false;
	}
	return this;