org.apache.xalan.xsltc.dom
Class NodeIteratorBase

java.lang.Object
  extended by org.apache.xalan.xsltc.dom.NodeIteratorBase
All Implemented Interfaces:
java.lang.Cloneable, NodeIterator

public abstract class NodeIteratorBase
extends java.lang.Object
implements NodeIterator


Field Summary
protected  boolean _includeSelf
          Flag indicating if "self" should be returned.
protected  boolean _isRestartable
          Flag indicating if iterator can be restarted.
protected  int _last
          Cached computed value of last().
protected  int _markedNode
          Store node in call to setMark().
protected  int _position
          Value of position() in this iterator.
protected  int _startNode
          Store node in call to setStartNode().
 
Fields inherited from interface org.apache.xalan.xsltc.NodeIterator
END
 
Constructor Summary
NodeIteratorBase()
           
 
Method Summary
 NodeIterator cloneIterator()
          Clones and resets this iterator.
 int getLast()
          Default implementation of getLast().
 int getPosition()
          Returns the position() in this iterator.
 NodeIterator includeSelf()
          Setter for _includeSelf flag.
 boolean isReverse()
          Indicates if position in this iterator is computed in reverse document order.
 NodeIterator reset()
          Reset this iterator using state from last call to setStartNode().
protected  NodeIterator resetPosition()
          Reset the position in this iterator.
protected  int returnNode(int node)
          Utility method that increments position and returns its argument.
 void setRestartable(boolean isRestartable)
          Setter for _isRestartable flag.
abstract  NodeIterator setStartNode(int node)
          Initialize iterator using a node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xalan.xsltc.NodeIterator
gotoMark, next, setMark
 

Field Detail

_last

protected int _last
Cached computed value of last().


_position

protected int _position
Value of position() in this iterator. Incremented in returnNode().


_markedNode

protected int _markedNode
Store node in call to setMark().


_startNode

protected int _startNode
Store node in call to setStartNode().


_includeSelf

protected boolean _includeSelf
Flag indicating if "self" should be returned.


_isRestartable

protected boolean _isRestartable
Flag indicating if iterator can be restarted.

Constructor Detail

NodeIteratorBase

public NodeIteratorBase()
Method Detail

setRestartable

public void setRestartable(boolean isRestartable)
Setter for _isRestartable flag.

Specified by:
setRestartable in interface NodeIterator

setStartNode

public abstract NodeIterator setStartNode(int node)
Initialize iterator using a node. If iterator is not restartable, then do nothing. If node is equal to END then subsequent calls to next() must return END.

Specified by:
setStartNode in interface NodeIterator

reset

public NodeIterator reset()
Reset this iterator using state from last call to setStartNode().

Specified by:
reset in interface NodeIterator

includeSelf

public NodeIterator includeSelf()
Setter for _includeSelf flag.


getLast

public int getLast()
Default implementation of getLast(). Stores current position and current node, resets the iterator, counts all nodes and restores iterator to original state.

Specified by:
getLast in interface NodeIterator

getPosition

public int getPosition()
Returns the position() in this iterator.

Specified by:
getPosition in interface NodeIterator

isReverse

public boolean isReverse()
Indicates if position in this iterator is computed in reverse document order. Note that nodes are always returned in document order.

Specified by:
isReverse in interface NodeIterator

cloneIterator

public NodeIterator cloneIterator()
Clones and resets this iterator. Note that the cloned iterator is not restartable. This is because cloning is needed for variable references, and the context node of the original variable declaration must be preserved.

Specified by:
cloneIterator in interface NodeIterator

returnNode

protected final int returnNode(int node)
Utility method that increments position and returns its argument.


resetPosition

protected final NodeIterator resetPosition()
Reset the position in this iterator.