Class MemoSequence

  • All Implemented Interfaces:

    public class MemoSequence
    extends java.lang.Object
    implements 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 Classes 
      Modifier and Type Class Description
      static class  MemoSequence.ProgressiveIterator
      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.
    • Method Detail

      • head

        public Item head()
                  throws XPathException
        Description copied from interface: Sequence
        Get the first item in the sequence.
        Specified by:
        head in interface Sequence
        the first item in the sequence if there is one, or null if the sequence is empty
        XPathException - in the situation where the sequence is evaluated lazily, and evaluation of the first item causes a dynamic error.
      • itemAt

        public Item itemAt​(int n)
                    throws XPathException
        Get the Nth item in the sequence (0-based), reading new items into the internal reservoir if necessary
        n - the index of the required item
        the Nth item if it exists, or null otherwise
        XPathException - if the input sequence cannot be read