Constructor and Description |
---|
LazySequence(SequenceIterator iterator)
Create a virtual sequence backed by an iterator
|
Modifier and Type | Method and Description |
---|---|
Item |
head()
Get the first item in the sequence.
|
SequenceIterator |
iterate()
Iterate over all the items in the sequence.
|
Sequence |
makeRepeatable()
Ensure that the sequence is in a form where it can be evaluated more than once.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
materialize
public LazySequence(SequenceIterator iterator)
iterator
- the iterator that delivers the items in the sequencepublic Item head() throws XPathException
head
in interface Sequence
XPathException
- if an error occurs evaluating the underlying expressionpublic SequenceIterator iterate()
iterate
in interface Sequence
UncheckedXPathException
- if evaluation of the iterator fails.java.lang.IllegalStateException
- if iterate() has already been calledpublic Sequence makeRepeatable() throws XPathException
Sequence
LazySequence
and Closure
can only be evaluated
once, and this operation causes these to be grounded. However, making it repeatable
is not the same as making it grounded; it does not flush out all errors. Indeed, lazy
evaluation relies on this property, because an expression that has been lifted out of
a loop must not be evaluated unless the loop is executed at least once, to prevent spurious
errors.makeRepeatable
in interface Sequence
XPathException
- if evaluation failsCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.