net.sf.saxon.om
Class ArrayIterator
java.lang.Object
net.sf.saxon.om.ArrayIterator
- GroundedIterator, LastPositionFinder, LookaheadIterator, ReversibleIterator, SequenceIterator, UnfailingIterator
public class ArrayIterator
extends java.lang.Object
ArrayIterator is used to enumerate items held in an array.
The items are always held in the correct sorted order for the sequence.
ArrayIterator(Item[] nodes) - Create an iterator over all the items in an array
|
ArrayIterator(Item[] items, int start, int end) - Create an iterator over a range of an array.
|
items
protected Item[] items
ArrayIterator
public ArrayIterator(Item[] nodes)
Create an iterator over all the items in an array
nodes
- the array (of any items, not necessarily nodes) to be
processed by the iterator
ArrayIterator
public ArrayIterator(Item[] items,
int start,
int end)
Create an iterator over a range of an array. Note that the start position is zero-based
items
- the array (of nodes or simple values) to be processed by
the iteratorstart
- the position of the first item to be processed
(numbering from zero). Must be between zero and nodes.length-1; if not,
undefined exceptions are likely to occur.end
- position of first item that is NOT returned, zero-based. Must be
beween 1 and nodes.length; if not, undefined exceptions are likely to occur.
getArray
public Item[] getArray()
Get the underlying array
- the underlying array being processed by the iterator
getEndPosition
public int getEndPosition()
Get the end position in the array
- the position in the array (zero-based) of the first item not included
in the iteration
getLastPosition
public int getLastPosition()
Get the number of items in the part of the array being processed
- getLastPosition in interface LastPositionFinder
- the number of items; equivalently, the position of the last
item
getProperties
public int getProperties()
Get properties of this iterator, as a bit-significant integer.
- getProperties in interface SequenceIterator
getStartPosition
public int getStartPosition()
Get the initial start position
- the start position of the iterator in the array (zero-based)
hasNext
public boolean hasNext()
Test whether there are any more items
- hasNext in interface LookaheadIterator
- true if there are more items
makeSliceIterator
public SequenceIterator makeSliceIterator(int min,
int max)
Create a new ArrayIterator over the same items,
with a different start point and end point
min
- the start position (1-based) of the new ArrayIterator
relative to the originalmax
- the end position (1-based) of the last item to be delivered
by the new ArrayIterator, relative to the original. For example, min=2, max=3
delivers the two items ($base[2], $base[3]). Set this to Integer.MAX_VALUE if
there is no end limit.
- an iterator over the items between the min and max positions
materialize
public GroundedValue materialize()
Return a SequenceValue containing all the items in the sequence returned by this
SequenceIterator
- materialize in interface GroundedIterator
- the corresponding SequenceValue