net.sf.saxon.expr

Class SubsequenceIterator

public class SubsequenceIterator extends Object implements SequenceIterator, LastPositionFinder, LookaheadIterator

A SubsequenceIterator selects a subsequence of a sequence
Method Summary
voidclose()
Itemcurrent()
SequenceIteratorgetAnother()
Get another iterator to return the same nodes
intgetLastPosition()
Get the last position (that is, the number of items in the sequence).
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
booleanhasNext()
Test whether there are any more items available in the sequence
static SequenceIteratormake(SequenceIterator base, int min, int max)
Static factory method.
Itemnext()
Get the next item if there is one
intposition()

Method Detail

close

public void close()

current

public Item current()

getAnother

public SequenceIterator getAnother()
Get another iterator to return the same nodes

getLastPosition

public int getLastPosition()
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 SubsequenceIterator

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 SubsequenceIterator, SubsequenceIterator, and SubsequenceIterator. 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()
Test whether there are any more items available in the sequence

make

public static SequenceIterator make(SequenceIterator base, int min, int max)
Static factory method. Creates a SubsequenceIterator, unless for example 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 min The position of the first item to be included (base 1) max The position of the last item to be included (base 1)

Returns: an iterator over the requested subsequence

next

public Item next()
Get the next item if there is one

position

public int position()