net.sf.saxon.tree

Class TreeEnumeration

abstract class TreeEnumeration extends Object implements AxisIterator, LookaheadIterator

Field Summary
protected NodeImplcurrent
protected NodeImplnext
protected NodeTestnodeTest
protected intposition
protected NodeImplstart
Constructor Summary
TreeEnumeration(NodeImpl origin, NodeTest nodeTest)
Create an axis enumeration for a given type and name of node, from a given origin node
Method Summary
protected voidadvance()
Advance along the axis until a node is found that matches the required criteria
protected booleanconforms(NodeImpl node)
Test whether a node conforms to the node type and name constraints.
Itemcurrent()
Return the current Item
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
booleanhasNext()
Determine whether there are more items to come.
Itemnext()
Return the next node in the enumeration
intposition()
Return the current position
protected abstract voidstep()
Advance one step along the axis: the resulting node might not meet the required criteria for inclusion

Field Detail

current

protected NodeImpl current

protected NodeImpl next

nodeTest

protected NodeTest nodeTest

position

protected int position

start

protected NodeImpl start

Constructor Detail

TreeEnumeration

public TreeEnumeration(NodeImpl origin, NodeTest nodeTest)
Create an axis enumeration for a given type and name of node, from a given origin node

Parameters: origin the node from which the axis originates nodeTest test to be satisfied by the returned nodes, or null if all nodes are to be returned.

Method Detail

advance

protected final void advance()
Advance along the axis until a node is found that matches the required criteria

conforms

protected boolean conforms(NodeImpl node)
Test whether a node conforms to the node type and name constraints. Note that this returns true if the supplied node is null, this is a way of terminating a loop.

current

public final Item current()
Return the current Item

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.

Returns: the properties of this iterator. This will be some combination of properties such as GROUNDED, LAST_POSITION_FINDER, and LOOKAHEAD. It is always acceptable to return the value zero, indicating that there are no known special properties. It is acceptable for the properties of the iterator to change depending on its state.

hasNext

public boolean hasNext()
Determine whether there are more items to come. Note that this operation is stateless and it is not necessary (or usual) to call it before calling next(). It is used only when there is an explicit need to tell if we are at the last element.

Returns: true if there are more items in the sequence

next

public final Item next()
Return the next node in the enumeration

position

public final int position()
Return the current position

step

protected abstract void step()
Advance one step along the axis: the resulting node might not meet the required criteria for inclusion