net.sf.saxon.expr
Class RangeIterator
java.lang.Object
net.sf.saxon.expr.RangeIterator
- GroundedIterator, LastPositionFinder, LookaheadIterator, ReversibleIterator, SequenceIterator
public class RangeIterator
extends java.lang.Object
An Iterator that produces numeric values in a monotonic sequence,
ascending or descending. Although a range expression (N to M) is always
in ascending order, applying the reverse() function will produce
a RangeIterator that works in descending order.
RangeIterator(long start, long end) - Create an iterator over a range of monotonically increasing integers
|
RangeIterator
public RangeIterator(long start,
long end)
Create an iterator over a range of monotonically increasing integers
start
- the first integer in the sequenceend
- the last integer in the sequence. Must be >= start.
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
SequenceIterator.LAST_POSITION_FINDER
- getLastPosition in interface LastPositionFinder
getProperties
public int getProperties()
Get properties of this iterator, as a bit-significant integer.
- getProperties in interface SequenceIterator
getReverseIterator
public SequenceIterator getReverseIterator()
Get a new SequenceIterator that returns the same items in reverse order.
If this SequenceIterator is an AxisIterator, then the returned SequenceIterator
must also be an AxisIterator.
- getReverseIterator in interface ReversibleIterator
- an iterator over the items in reverse order
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.
This method must not be called unless the result of getProperties() on the iterator
includes the bit setting
SequenceIterator.LOOKAHEAD
- hasNext in interface LookaheadIterator
- true if there are more items in the sequence