Package net.sf.saxon.tree.iter
Class RangeIterator
- java.lang.Object
-
- net.sf.saxon.tree.iter.RangeIterator
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,SequenceIterator
,GroundedIterator
- Direct Known Subclasses:
BigRangeIterator
public abstract class RangeIterator extends java.lang.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 Summary
Constructors Constructor Description RangeIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
containsEq(NumericValue val)
Ask whether the iterator will deliver a value equal to a supplied valueabstract IntegerValue
getFirst()
abstract IntegerValue
getLast()
abstract IntegerValue
getMax()
abstract IntegerValue
getMin()
abstract GroundedValue
getResidue()
Return a GroundedValue containing all the remaining items in the sequence returned by this SequenceIterator, starting at the current position.abstract IntegerValue
getStep()
Get the increment between successive values.-
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.tree.iter.GroundedIterator
isActuallyGrounded, materialize
-
Methods inherited from interface net.sf.saxon.om.SequenceIterator
close, discharge, next
-
-
-
-
Method Detail
-
getResidue
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 interfaceGroundedIterator
- 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
public abstract IntegerValue getFirst()
-
getLast
public abstract IntegerValue getLast()
-
getMin
public abstract IntegerValue getMin()
-
getMax
public abstract IntegerValue getMax()
-
getStep
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
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
-
-