net.sf.saxon.value

Class IntegerRange

public class IntegerRange extends Value

This class represents a sequence of consecutive ascending integers, for example 1 to 50. The integers must be within the range of a Java long.
Field Summary
longend
longstart
Constructor Summary
IntegerRange(long start, long end)
Method Summary
voiddisplay(int level, NamePool pool, PrintStream out)
Diagnostic display of the expression
intgetCardinality()
Determine the cardinality
longgetEnd()
intgetImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items in the expression, if possible
intgetLength()
Get the length of the sequence
longgetStart()
ItemitemAt(int n)
Get the n'th item in the sequence (starting from 0).
SequenceIteratoriterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.

Field Detail

end

public long end

start

public long start

Constructor Detail

IntegerRange

public IntegerRange(long start, long end)

Method Detail

display

public void display(int level, NamePool pool, PrintStream out)
Diagnostic display of the expression

getCardinality

public int getCardinality()
Determine the cardinality

getEnd

public long getEnd()

getImplementationMethod

public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items in the expression, if possible

Parameters: th

Returns: AnyItemType (not known)

getLength

public int getLength()
Get the length of the sequence

getStart

public long getStart()

itemAt

public Item itemAt(int n)
Get the n'th item in the sequence (starting from 0). This is defined for all Values, but its real benefits come for a sequence Value stored extensionally (or for a MemoClosure, once all the values have been read)

iterate

public SequenceIterator iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.

Parameters: context supplies the context for evaluation

Returns: a SequenceIterator that can be used to iterate over the result of the expression

Throws: net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the expression