T
- the item type of the items returned by the ArrayIteratorpublic static class ArrayIterator.Of<T extends Item> extends ArrayIterator
ArrayIterator.Of<T extends Item>, ArrayIterator.OfNodes<N extends NodeInfo>
Modifier and Type | Field and Description |
---|---|
protected T[] |
items |
end, index, start
Constructor and Description |
---|
Of(T[] items) |
Of(T[] items,
int start,
int end)
Create an iterator over a range of an array.
|
Modifier and Type | Method and Description |
---|---|
T[] |
getArray()
Get the underlying array
|
int |
getEndPosition()
Get the end position in the array
|
int |
getLength()
Get the number of items in the part of the array being processed
|
GroundedValue |
getResidue()
Return a GroundedValue containing all the remaining items in the sequence returned by this
SequenceIterator, starting at the current position.
|
SequenceIterator |
getReverseIterator()
Get a new SequenceIterator that returns the same items in reverse order.
|
int |
getStartPosition()
Get the initial start position
|
boolean |
hasNext()
Test whether there are any more items
|
SequenceIterator |
makeSliceIterator(int min,
int max)
Create a new ArrayIterator over the same items,
with a different start point and end point
|
GroundedValue |
materialize()
Return a SequenceValue containing all the items in the sequence returned by this
SequenceIterator
|
Item |
next()
Get the next item in the array
|
boolean |
supportsGetLength()
Ask whether this iterator supports use of the
LastPositionFinder.getLength() method. |
isActuallyGrounded, supportsHasNext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, discharge
public Of(T[] items)
public Of(T[] items, int start, int end)
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
between 1 and nodes.length; if not, undefined exceptions are likely to occur.public SequenceIterator makeSliceIterator(int min, int max)
makeSliceIterator
in class ArrayIterator
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.public boolean hasNext()
public Item next()
public boolean supportsGetLength()
LastPositionFinder
LastPositionFinder.getLength()
method. This
method should always be called before calling LastPositionFinder.getLength()
, because an iterator
that implements this interface may support use of LastPositionFinder.getLength()
in some situations
and not in othersLastPositionFinder.getLength()
method can be called to determine the length
of the underlying sequence.public int getLength()
public T[] getArray()
public int getStartPosition()
public int getEndPosition()
public GroundedValue materialize()
public GroundedValue getResidue()
GroundedIterator
public SequenceIterator getReverseIterator()
ReversibleIterator
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.