Class SequenceExtent

  • All Implemented Interfaces:
    GroundedValue, Sequence
    Direct Known Subclasses:
    SequenceExtent.Of

    public abstract class SequenceExtent
    extends java.lang.Object
    implements GroundedValue
    A sequence value implemented extensionally. That is, this class represents a sequence by allocating memory to each item in the sequence.
    • Constructor Detail

      • SequenceExtent

        public SequenceExtent()
    • Method Detail

      • from

        public static SequenceExtent.Of<Item> from​(SequenceIterator iter)
        Construct a sequence containing all the remaining items in a SequenceIterator.
        Parameters:
        iter - The supplied sequence of items. The returned sequence will contain all items delivered by repeated calls on next() on this iterator, and the iterator will be consumed by calling the method.
        Returns:
        a sequence of the remaining items
        Throws:
        UncheckedXPathException - if reading the items using the SequenceIterator raises an error
      • makeResidue

        public static GroundedValue makeResidue​(SequenceIterator iter)
        Factory method to make a GroundedValue holding the remaining contents of any SequenceIterator, that is, the contents that have not yet been read
        Parameters:
        iter - a Sequence iterator that may or may not be consumed to deliver the items in the sequence. The iterator need not be positioned at the start.
        Returns:
        a GroundedValue holding the items delivered by the SequenceIterator. If the sequence is empty the result will be an instance of EmptySequence. If it is of length one, the result will be an Item. In all other cases, it will be an instance of SequenceExtent.
        Throws:
        UncheckedXPathException - if an error occurs processing the values from the iterator.
      • makeSequenceExtent

        public static <T extends ItemGroundedValue makeSequenceExtent​(java.util.List<T> input)
        Factory method to make a Value holding the contents of any List of items
        Type Parameters:
        T - the type of items in the list
        Parameters:
        input - a List containing the items in the sequence. The caller guarantees that the list will not be subsequently modified.
        Returns:
        a grounded sequence holding the items in the list. If the sequence is empty the result will be an instance of EmptySequence. If it is of length one, the result will be an Item. In all other cases, it will be an instance of SequenceExtent.