Package net.sf.saxon.om
Class MemoSequence
java.lang.Object
net.sf.saxon.om.MemoSequence
- All Implemented Interfaces:
Sequence
A Sequence implementation that represents a lazy evaluation of a supplied iterator. Items
are read from the base iterator only when they are first required, and are then remembered
within the local storage of the MemoSequence, which eventually (if the sequence is read
to the end) contains the entire value.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A ProgressiveIterator starts by reading any items already held in the reservoir; when the reservoir is exhausted, it reads further items from the inputIterator, copying them into the reservoir as they are read. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionhead()
Get the first item in the sequence.itemAt
(int n) Get the Nth item in the sequence (0-based), reading new items into the internal reservoir if necessaryiterate()
Get aSequenceIterator
over all the items in the sequencevoid
setLearningEvaluator
(LearningEvaluator caller, int serialNumber) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable, materialize
-
Constructor Details
-
MemoSequence
-
-
Method Details
-
setLearningEvaluator
-
head
Description copied from interface:Sequence
Get the first item in the sequence.- Specified by:
head
in interfaceSequence
- Returns:
- the first item in the sequence if there is one, or null if the sequence is empty
- Throws:
XPathException
- in the situation where the sequence is evaluated lazily, and evaluation of the first item causes a dynamic error.
-
iterate
Description copied from interface:Sequence
Get aSequenceIterator
over all the items in the sequence- Specified by:
iterate
in interfaceSequence
- Returns:
- an iterator (specifically, a Saxon
SequenceIterator
, which is not aIterator
) over all the items
-
itemAt
Get the Nth item in the sequence (0-based), reading new items into the internal reservoir if necessary- Parameters:
n
- the index of the required item- Returns:
- the Nth item if it exists, or null otherwise
- Throws:
XPathException
- if the input sequence cannot be read
-