Class EmptyIterator

    • Constructor Detail

      • EmptyIterator

        public EmptyIterator()
    • Method Detail

      • getInstance

        public static EmptyIterator getInstance()
        Get an EmptyIterator, an iterator over an empty sequence.
        Returns:
        an EmptyIterator (in practice, this always returns the same one)
      • next

        public Item next()
        Get the next item. This method should not be called unless hasNext() returns true.
        Specified by:
        next in interface AxisIterator
        Specified by:
        next in interface SequenceIterator
        Returns:
        the next item. For the EmptyIterator this is always null.
      • current

        public Item current()
        Get the current item, that is, the item returned by the most recent call of next().
        Specified by:
        current in interface AxisIterator
        Specified by:
        current in interface SequenceIterator
        Returns:
        the current item. For the EmptyIterator this is always null.
      • position

        public int position()
        Get the position of the current item.
        Specified by:
        position in interface AxisIterator
        Specified by:
        position in interface SequenceIterator
        Returns:
        the position of the current item. For the EmptyIterator this is always zero (whether or not the next() method has been called).
      • getLastPosition

        public int getLastPosition()
        Get the position of the last item in the sequence.
        Specified by:
        getLastPosition in interface LastPositionFinder
        Returns:
        the position of the last item in the sequence, always zero in this implementation
      • getAnother

        public SequenceIterator getAnother()
        Get another iterator over the same items, positioned at the start.
        Specified by:
        getAnother in interface AxisIterator
        Specified by:
        getAnother in interface SequenceIterator
        Returns:
        another iterator over an empty sequence (in practice, it returns the same iterator each time)
      • getReverseIterator

        public SequenceIterator getReverseIterator()
        Get another iterator over the same items, in reverse order.
        Specified by:
        getReverseIterator in interface ReversibleIterator
        Returns:
        a reverse iterator over an empty sequence (in practice, it returns the same iterator each time)
      • materialize

        public Value materialize()
        Return a Value containing all the items in the sequence returned by this SequenceIterator. This should be an "in-memory" value, not a Closure.
        Specified by:
        materialize in interface GroundedIterator
        Returns:
        the corresponding Value
      • hasNext

        public boolean hasNext()
        Determine whether there are more items to come. Note that this operation is stateless and it is not necessary (or usual) to call it before calling next(). It is used only when there is an explicit need to tell if we are at the last element.
        Specified by:
        hasNext in interface LookaheadIterator
        Returns:
        true if there are more nodes