net.sf.saxon.expr

Class TailIterator

Implemented Interfaces:
LastPositionFinder, LookaheadIterator, SequenceIterator

public class TailIterator
extends java.lang.Object
implements SequenceIterator, LastPositionFinder, LookaheadIterator

TailIterator iterates over a base sequence starting at an element other than the first. The base sequence is represented by an iterator which is consumed in the process

Fields inherited from interface net.sf.saxon.om.SequenceIterator

GROUNDED, LAST_POSITION_FINDER, LOOKAHEAD

Method Summary

Item
current()
SequenceIterator
getAnother()
int
getLastPosition()
Get the last position (that is, the number of items in the sequence).
int
getProperties()
Get properties of this iterator, as a bit-significant integer.
boolean
hasNext()
Determine whether there are more items to come.
static SequenceIterator
make(SequenceIterator base, int start)
Static factory method.
Item
next()
int
position()

Method Details

current

public Item current()
Specified by:
current in interface SequenceIterator

getAnother

public SequenceIterator getAnother()
            throws XPathException
Specified by:
getAnother in interface SequenceIterator

getLastPosition

public int getLastPosition()
            throws XPathException
Get the last position (that is, the number of items in the sequence). This method is non-destructive: it does not change the state of the iterator. The result is undefined if the next() method of the iterator has already returned null. This method must not be called unless the result of getProperties() on the iterator includes the bit setting SequenceIterator.LAST_POSITION_FINDER
Specified by:
getLastPosition in interface LastPositionFinder

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.
Specified by:
getProperties in interface SequenceIterator
Returns:
the properties of this iterator. This will be some combination of properties such as SequenceIterator.GROUNDED, SequenceIterator.LAST_POSITION_FINDER, and SequenceIterator.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()
Specified by:
hasNext in interface LookaheadIterator
Returns:
true if there are more items in the sequence

make

public static SequenceIterator make(SequenceIterator base,
                                    int start)
            throws XPathException
Static factory method. Creates a TailIterator, unless the base Iterator is an ArrayIterator, in which case it optimizes by creating a new ArrayIterator directly over the underlying array. This optimization is important when doing recursion over a node-set using repeated calls of $nodes[position()>1]
Parameters:
base - An iteration of the items to be filtered
start - The position of the first item to be included (base 1)
Returns:
an iterator over the items in the sequence from the start item to the end of the sequence. The returned iterator will not necessarily be an instance of this class.

next

public Item next()
            throws XPathException
Specified by:
next in interface SequenceIterator

position

public int position()
Specified by:
position in interface SequenceIterator