public class TwoItemIterator extends java.lang.Object implements SequenceIterator, LookaheadIterator, GroundedIterator, LastPositionFinder
Constructor and Description |
---|
TwoItemIterator(Item one,
Item two)
Create an iterator over two objects
|
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.
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
boolean |
isActuallyGrounded()
Ask if the iterator is actually grounded.
|
Item |
next()
Returns the next element in the iteration.
|
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, wait
materialize
close, discharge
public boolean supportsHasNext()
LookaheadIterator
supportsHasNext
in interface LookaheadIterator
LookaheadIterator.hasNext()
method is availablepublic boolean hasNext()
hasNext
in interface LookaheadIterator
public Item next()
next
in interface SequenceIterator
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 otherssupportsGetLength
in interface LastPositionFinder
LastPositionFinder.getLength()
method can be called to determine the length
of the underlying sequence.public int getLength()
LastPositionFinder
LastPositionFinder.supportsGetLength()
has been called
and has returned true.getLength
in interface LastPositionFinder
public boolean isActuallyGrounded()
GroundedIterator
GroundedIterator.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 GroundedIterator
public GroundedValue getResidue()
GroundedIterator
getResidue
in interface GroundedIterator
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.