net.sf.saxon.om

Class SingleNodeIterator

public class SingleNodeIterator extends Object implements AxisIterator, UnfailingIterator, ReversibleIterator, LastPositionFinder, GroundedIterator, LookaheadIterator

SingletonIterator: an iterator over a sequence of zero or one values
Method Summary
Valueatomize()
Return the atomized value of the current node.
voidclose()
Itemcurrent()
SequenceIteratorgetAnother()
intgetLastPosition()
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
SequenceIteratorgetReverseIterator()
CharSequencegetStringValue()
Return the string value of the current node.
ItemgetValue()
booleanhasNext()
Determine whether there are more items to come.
AxisIteratoriterateAxis(byte axis, NodeTest test)
Return an iterator over an axis, starting at the current node.
static AxisIteratormakeIterator(NodeInfo item)
Factory method.
GroundedValuematerialize()
Return a Value containing all the items in the sequence returned by this SequenceIterator
booleanmoveNext()
Move to the next node, without returning it.
Itemnext()
intposition()
Return the current position in the sequence.

Method Detail

atomize

public Value atomize()
Return the atomized value of the current node.

Returns: the atomized value.

Throws: NullPointerException if there is no current node

close

public void close()

current

public Item current()

getAnother

public SequenceIterator getAnother()

getLastPosition

public int getLastPosition()

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 SingleNodeIterator, SingleNodeIterator, and SingleNodeIterator. 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.

getReverseIterator

public SequenceIterator getReverseIterator()

getStringValue

public CharSequence getStringValue()
Return the string value of the current node.

Returns: the string value, as an instance of CharSequence.

Throws: NullPointerException if there is no current node

getValue

public Item getValue()

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

iterateAxis

public AxisIterator iterateAxis(byte axis, NodeTest test)
Return an iterator over an axis, starting at the current node.

Parameters: axis the axis to iterate over, using a constant such as CHILD test a predicate to apply to the nodes before returning them.

makeIterator

public static AxisIterator makeIterator(NodeInfo item)
Factory method.

Parameters: item the item to iterate over

Returns: a SingletonIterator over the supplied item, or an EmptyIterator if the supplied item is null.

materialize

public GroundedValue materialize()
Return a Value containing all the items in the sequence returned by this SequenceIterator

Returns: the corresponding Value. If the value is a closure or a function call package, it will be evaluated and expanded.

moveNext

public boolean moveNext()
Move to the next node, without returning it. Returns true if there is a next node, false if the end of the sequence has been reached. After calling this method, the current node may be retrieved using the current() function.

next

public Item next()

position

public int position()
Return the current position in the sequence.

Returns: 0 before the first call on next(); 1 before the second call on next(); -1 after the second call on next().