net.sf.saxon.om
Class ReverseArrayIterator
java.lang.Object
net.sf.saxon.om.ReverseArrayIterator
- LastPositionFinder, LookaheadIterator, ReversibleIterator, SequenceIterator, UnfailingIterator
public class ReverseArrayIterator
extends java.lang.Object
ReverseArrayIterator is used to enumerate items held in an array in reverse order.
ReverseArrayIterator
public ReverseArrayIterator(Item[] items,
int start,
int end)
Create an iterator a slice of an array
items
- The array of itemsstart
- The first item in the array to be be used (this will be the last
one in the resulting iteration). Zero-based.end
- The item after the last one in the array to be used (this will be the
first one to be returned by the iterator). Zero-based.
getAnother
public SequenceIterator getAnother()
Get another iterator over the same sequence of items, positioned at the
start of the sequence. It must be possible to call this method at any time, whether
none, some, or all of the items in the original iterator have been read. The method
is non-destructive: it does not change the state of the original iterator.
- getAnother in interface UnfailingIterator
- getAnother in interface SequenceIterator
- a new iterator over the same sequence
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 an iterator that processes the same items in reverse order.
Since this iterator is processing the items backwards, this method
returns an ArrayIterator that processes them forwards.
- getReverseIterator in interface ReversibleIterator
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.
- hasNext in interface LookaheadIterator
- true if there are more items in the sequence