org.apache.xml.dtm.ref
Class DTMAxisIteratorBase
java.lang.Object
org.apache.xml.dtm.ref.DTMAxisIteratorBase
- Cloneable, DTMAxisIterator
public abstract class DTMAxisIteratorBase
extends java.lang.Object
This class serves as a default base for implementations of mutable
DTMAxisIterators.
cloneIterator
public DTMAxisIterator cloneIterator()
Returns a deep copy of this iterator. Cloned iterators may not be
restartable. The iterator being cloned may or may not become
non-restartable as a side effect of this operation.
- cloneIterator in interface DTMAxisIterator
- a deep copy of this iterator.
getAxis
public int getAxis()
Returns the axis being iterated, if it is known.
- Axis.CHILD, etc., or -1 if the axis is not known or is of multiple
types.
getLast
public int getLast()
Returns the position of the last node within the iteration, as
defined by XPath. In a forward iterator, I believe this equals the number of nodes which this
iterator will yield. In a reverse iterator, I believe it should return
1 (since the "last" is the first produced.)
This may be an expensive operation when called the first time, since
it may have to iterate through a large part of the document to produce
its answer.
- getLast in interface DTMAxisIterator
- The number of nodes in this iterator (forward) or 1 (reverse).
getNodeByPosition
public int getNodeByPosition(int position)
Return the node at the given position.
- getNodeByPosition in interface DTMAxisIterator
position
- The position
- The node at the given position.
getPosition
public int getPosition()
- getPosition in interface DTMAxisIterator
- The position of the current node within the set, as defined by
XPath. Note that this is one-based, not zero-based.
getStartNode
public int getStartNode()
Get start to END should 'close' the iterator,
i.e. subsequent call to next() should return END.
- getStartNode in interface DTMAxisIterator
- The root node of the iteration.
includeSelf
public DTMAxisIterator includeSelf()
Set the flag to include the start node in the iteration.
- This default method returns just returns this DTMAxisIterator,
after setting the flag.
(Returning "this" permits C++-style chaining of
method calls into a single expression.)
isDocOrdered
public boolean isDocOrdered()
Returns true if all the nodes in the iteration well be returned in document
order.
- true as a default.
isReverse
public boolean isReverse()
- isReverse in interface DTMAxisIterator
- true if this iterator has a reversed axis, else false
reset
public DTMAxisIterator reset()
- reset in interface DTMAxisIterator
- A DTMAxisIterator which has been reset to the start node,
which may or may not be the same as this iterator.
Copyright B) 2004 Apache XML Project. All Rights Reserved.