Class RangeIterator

java.lang.Object
net.sf.saxon.tree.iter.RangeIterator
All Implemented Interfaces:
Closeable, AutoCloseable, SequenceIterator, GroundedIterator
Direct Known Subclasses:
AscendingRangeIterator, BigRangeIterator, DescendingRangeIterator

public abstract class RangeIterator extends Object implements GroundedIterator
This abstract class represents an iteration over the results of a range expression (A by B to C). There are implementations for ascending and descending iterators, implemented separately for integer ranges within the 64-bit long range, and for ranges that might include larger integers.

As well as being able to deliver a sequence of integers, these iterators also allow testing the length of the sequence returned, for the existence of a particular value, for the minimum and maximum values, for the first and last values, and for the Nth value.

  • Constructor Details Link icon

    • RangeIterator Link icon

      public RangeIterator()
  • Method Details Link icon

    • getResidue Link icon

      public abstract GroundedValue getResidue()
      Return a GroundedValue containing all the remaining items in the sequence returned by this SequenceIterator, starting at the current position. This should be an "in-memory" value, not a Closure. This method does not change the state of the iterator (in particular, it does not consume the iterator).
      Specified by:
      getResidue in interface GroundedIterator
      Returns:
      the corresponding Value
      Throws:
      UncheckedXPathException - in the cases of subclasses (such as the iterator over a MemoClosure) which cause evaluation of expressions while materializing the value.
    • getFirst Link icon

      public abstract IntegerValue getFirst()
    • getLast Link icon

      public abstract IntegerValue getLast()
    • getMin Link icon

      public abstract IntegerValue getMin()
    • getMax Link icon

      public abstract IntegerValue getMax()
    • getStep Link icon

      public abstract IntegerValue getStep()
      Get the increment between successive values. For a descending iterator this will be negatiive value.
      Returns:
      the increment between successive values
    • containsEq Link icon

      public boolean containsEq(NumericValue val)
      Ask whether the iterator will deliver a value equal to a supplied value
      Parameters:
      val - the supplied value
      Returns:
      true if the value is one of those that the iterator will deliver