Top Description Fields Constructors Methods
com.sun.org.apache.xml.internal.dtm.ref

public abstract Class DTMAxisIteratorBase

extends Object
implements DTMAxisIterator
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.xml.internal.dtm.DTMAxisIterator, java.lang.Cloneable
Known Direct Subclasses
com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBaseIterators.InternalAxisIteratorBase, com.sun.org.apache.xalan.internal.xsltc.dom.AbsoluteIterator, com.sun.org.apache.xalan.internal.xsltc.dom.CachedNodeListIterator, com.sun.org.apache.xalan.internal.xsltc.dom.ClonedNodeListIterator, com.sun.org.apache.xalan.internal.xsltc.dom.CurrentNodeListIterator, com.sun.org.apache.xalan.internal.xsltc.dom.DupFilterIterator, com.sun.org.apache.xalan.internal.xsltc.dom.FilterIterator, com.sun.org.apache.xalan.internal.xsltc.dom.ForwardPositionIterator, com.sun.org.apache.xalan.internal.xsltc.dom.KeyIndex, com.sun.org.apache.xalan.internal.xsltc.dom.MatchingIterator, com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM.AxisIterator, com.sun.org.apache.xalan.internal.xsltc.dom.MultiDOM.NodeValueIterator, com.sun.org.apache.xalan.internal.xsltc.dom.MultiValuedNodeHeapIterator, com.sun.org.apache.xalan.internal.xsltc.dom.NthIterator, com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl.SimpleIterator, com.sun.org.apache.xalan.internal.xsltc.dom.SimpleResultTreeImpl.SingletonIterator, com.sun.org.apache.xalan.internal.xsltc.dom.SingletonIterator, com.sun.org.apache.xalan.internal.xsltc.dom.SortingIterator, com.sun.org.apache.xalan.internal.xsltc.dom.StepIterator
Imports
com.sun.org.apache.xml.internal.dtm.DTMAxisIterator

This class serves as a default base for implementations of mutable DTMAxisIterators.

Field Summary

Modifier and TypeField and Description
protected boolean
_includeSelf

True if the start node should be considered part of the iteration.

protected boolean
_isRestartable

True if this iteration can be restarted.

protected int
_last

The position of the last node within the iteration, as defined by XPath.

protected int
_markedNode

The position of the marked node within the iteration; a saved itaration state that we may want to come back to.

protected int
_position

The position of the current node within the iteration, as defined by XPath.

protected int
_startNode

The handle to the start, or root, of the iteration.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DTMAxisIterator

Returns:

a deep copy of this iterator.
cloneIterator
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.cloneIterator.

Returns a deep copy of this iterator.

public int

Returns:

Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
getAxis
()

Returns the axis being iterated, if it is known.

public int

Returns:

The number of nodes in this iterator (forward) or 1 (reverse).
getLast
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getLast.

Returns the position of the last node within the iteration, as defined by XPath.

public int

Returns:

The node at the given position.
getNodeByPosition
(int
The position
position
)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getNodeByPosition.

Return the node at the given position.

public int

Returns:

The position of the current node within the set, as defined by XPath. Note that this is one-based, not zero-based.
getPosition
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getPosition.

public int

Returns:

The root node of the iteration.
getStartNode
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getStartNode.

Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

public DTMAxisIterator

Returns:

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

Set the flag to include the start node in the iteration.

public boolean

Returns:

true as a default.
isDocOrdered
()

Returns true if all the nodes in the iteration well be returned in document order.

public boolean

Returns:

true if this iterator has a reversed axis, else false
isReverse
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.isReverse.

public DTMAxisIterator

Returns:

A DTMAxisIterator which has been reset to the start node, which may or may not be the same as this iterator.
reset
()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.reset.

Resets the iterator to the last start node.

protected final DTMAxisIterator

Returns:

This instance.
resetPosition
()

Reset the position to zero.

protected final int

Returns:

The node handle passed in.
returnNode
(final int
Node handle which iteration is about to yield.
node
)

Do any final cleanup that is required before returning the node that was passed in, and then return it.

public void
setRestartable(boolean isRestartable)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setRestartable.

Set if restartable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_includeSelfback to summary
protected boolean _includeSelf

True if the start node should be considered part of the iteration. False will cause it to be skipped.

_isRestartableback to summary
protected boolean _isRestartable

True if this iteration can be restarted. False otherwise (eg, if we are iterating over a stream that can not be re-scanned, or if the iterator was produced by cloning another iterator.)

_lastback to summary
protected int _last

The position of the last node within the iteration, as defined by XPath. Note that this is _not_ the node's handle within the DTM. Also, don't confuse it with the current (most recently returned) position.

_markedNodeback to summary
protected int _markedNode

The position of the marked node within the iteration; a saved itaration state that we may want to come back to. Note that only one mark is maintained; there is no stack.

_positionback to summary
protected int _position

The position of the current node within the iteration, as defined by XPath. Note that this is _not_ the node's handle within the DTM!

_startNodeback to summary
protected int _startNode

The handle to the start, or root, of the iteration. Set this to END to construct an empty iterator.

Constructor Detail

DTMAxisIteratorBaseback to summary
public DTMAxisIteratorBase()

Method Detail

cloneIteratorback to summary
public DTMAxisIterator cloneIterator()

Implements com.sun.org.apache.xml.internal.dtm.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.

Returns:DTMAxisIterator

a deep copy of this iterator.

getAxisback to summary
public int getAxis()

Returns the axis being iterated, if it is known.

Returns:int

Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.

getLastback to summary
public int getLast()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.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.

Returns:int

The number of nodes in this iterator (forward) or 1 (reverse).

getNodeByPositionback to summary
public int getNodeByPosition(int position)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getNodeByPosition.

Return the node at the given position.

Parameters
position:int

The position

Returns:int

The node at the given position.

getPositionback to summary
public int getPosition()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getPosition.

Returns:int

The position of the current node within the set, as defined by XPath. Note that this is one-based, not zero-based.

getStartNodeback to summary
public int getStartNode()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getStartNode.

Get start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

Returns:int

The root node of the iteration.

includeSelfback to summary
public DTMAxisIterator includeSelf()

Set the flag to include the start node in the iteration.

Returns:DTMAxisIterator

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

isDocOrderedback to summary
public boolean isDocOrdered()

Returns true if all the nodes in the iteration well be returned in document order.

Returns:boolean

true as a default.

isReverseback to summary
public boolean isReverse()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.isReverse.

Returns:boolean

true if this iterator has a reversed axis, else false

resetback to summary
public DTMAxisIterator reset()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.reset.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.reset.

Resets the iterator to the last start node.

Returns:DTMAxisIterator

A DTMAxisIterator which has been reset to the start node, which may or may not be the same as this iterator.

resetPositionback to summary
protected final DTMAxisIterator resetPosition()

Reset the position to zero. NOTE that this does not change the iteration state, only the position number associated with that state. %REVIEW% Document when this would be used?

Returns:DTMAxisIterator

This instance.

returnNodeback to summary
protected final int returnNode(final int node)

Do any final cleanup that is required before returning the node that was passed in, and then return it. The intended use is
return returnNode(node); %REVIEW% If we're calling it purely for side effects, should we really be bothering with a return value? Something like
accept(node); return node;
would probably optimize just about as well and avoid questions about whether what's returned could ever be different from what's passed in.

Parameters
node:int

Node handle which iteration is about to yield.

Returns:int

The node handle passed in.

setRestartableback to summary
public void setRestartable(boolean isRestartable)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setRestartable.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setRestartable.

Set if restartable.