public class SingletonIterator extends java.lang.Object implements SequenceIterator, ReversibleIterator, LastPositionFinder, GroundedIterator, LookaheadIterator
| Modifier | Constructor and Description |
|---|---|
protected |
SingletonIterator(Item value)
Private constructor: external classes should use the factory method
|
| Modifier and Type | Method and Description |
|---|---|
int |
getLength()
Get the last position (that is, the number of items in the sequence).
|
GroundedValue |
getResidue()
Return a GroundedValue containing all the remaining items in the sequence returned by this
SequenceIterator, starting at the current position.
|
SingletonIterator |
getReverseIterator()
Get a new SequenceIterator that returns the same items in reverse order.
|
Item |
getValue() |
boolean |
hasNext()
Determine whether there are more items to come.
|
boolean |
isActuallyGrounded()
Ask if the iterator is actually grounded.
|
static SequenceIterator |
makeIterator(Item item)
Factory method.
|
GroundedValue |
materialize()
Return a Value containing all the items in the sequence returned by this
SequenceIterator
|
Item |
next()
Get the next item in the sequence.
|
boolean |
supportsGetLength()
Ask whether this iterator supports use of the
LastPositionFinder.getLength() method. |
boolean |
supportsHasNext()
Ask whether the hasNext() method can be called.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, dischargeprotected SingletonIterator(Item value)
value - the item to iterate overpublic static SequenceIterator makeIterator(Item item)
item - the item to iterate overpublic boolean supportsHasNext()
LookaheadIteratorsupportsHasNext in interface LookaheadIteratorLookaheadIterator.hasNext() method is availablepublic boolean hasNext()
hasNext in interface LookaheadIteratorpublic Item next()
SequenceIteratornext in interface SequenceIteratorpublic boolean supportsGetLength()
LastPositionFinderLastPositionFinder.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 otherssupportsGetLength in interface LastPositionFinderLastPositionFinder.getLength() method can be called to determine the length
of the underlying sequence.public int getLength()
LastPositionFinderLastPositionFinder.supportsGetLength() has been called
and has returned true.getLength in interface LastPositionFinderpublic boolean isActuallyGrounded()
GroundedIteratorGroundedIterator.materialize() or GroundedIterator.getResidue(), because the iterator might
be grounded under some conditions and not others (usually when it delegates
to another iterator)isActuallyGrounded in interface GroundedIteratorpublic SingletonIterator getReverseIterator()
ReversibleIteratorgetReverseIterator in interface ReversibleIteratorpublic Item getValue()
public GroundedValue materialize()
materialize in interface GroundedIteratorpublic GroundedValue getResidue()
GroundedIteratorgetResidue in interface GroundedIteratorCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.