net.sf.saxon.expr

Class IntegerRangeTest

public class IntegerRangeTest extends ComputedExpression

An IntegerRangeTest is an expression of the form E = N to M where E, N, and M are all expressions of type integer.
Field Summary
Expressionmax
Expressionmin
Expressionvalue
Constructor Summary
IntegerRangeTest(Expression value, Expression min, Expression max)
Construct a IntegerRangeTest
Method Summary
intcomputeCardinality()
Determine the static cardinality
voiddisplay(int level, NamePool pool, PrintStream out)
Display this instruction as an expression, for diagnostics
ItemevaluateItem(XPathContext c)
Evaluate the expression
ItemTypegetItemType(TypeHierarchy th)
Get the data type of the items returned
IteratoriterateSubExpressions()
Get the immediate sub-expressions of this expression.
Expressionoptimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
ExpressiontypeCheck(StaticContext env, ItemType contextItemType)

Field Detail

max

Expression max

min

Expression min

value

Expression value

Constructor Detail

IntegerRangeTest

public IntegerRangeTest(Expression value, Expression min, Expression max)
Construct a IntegerRangeTest

Method Detail

computeCardinality

public int computeCardinality()
Determine the static cardinality

display

public void display(int level, NamePool pool, PrintStream out)
Display this instruction as an expression, for diagnostics

evaluateItem

public Item evaluateItem(XPathContext c)
Evaluate the expression

getItemType

public ItemType getItemType(TypeHierarchy th)
Get the data type of the items returned

Parameters: th

iterateSubExpressions

public Iterator iterateSubExpressions()
Get the immediate sub-expressions of this expression. Default implementation returns a zero-length array, appropriate for an expression that has no sub-expressions.

Returns: an iterator containing the sub-expressions of this expression

optimize

public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.

This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

Parameters: opt the optimizer in use. This provides access to supporting functions; it also allows different optimization strategies to be used in different circumstances. env the static context of the expression contextItemType the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to ITEM_TYPE

Returns: the original expression, rewritten if appropriate to optimize execution

Throws: net.sf.saxon.trans.StaticError if an error is discovered during this phase (typically a type error)

typeCheck

public Expression typeCheck(StaticContext env, ItemType contextItemType)