net.sf.saxon.expr

Class IntegerRangeTest

public class IntegerRangeTest extends Expression

An IntegerRangeTest is an expression of the form E = N to M where E is numeric, and N and M are both 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
Expressioncopy()
Copy an expression.
ItemevaluateItem(XPathContext c)
Evaluate the expression
voidexplain(ExpressionPresenter destination)
Diagnostic print of expression structure.
ItemTypegetItemType(TypeHierarchy th)
Get the data type of the items returned
ExpressiongetMaxValueExpression()
Get the expression denoting the end of the range
ExpressiongetMinValueExpression()
Get the expression denoting the start of the range
ExpressiongetValueExpression()
Get the value to be tested
Iterator<Expression>iterateSubExpressions()
Get the immediate sub-expressions of this expression.
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
Perform optimisation of an expression and its subexpressions.
Expressionpromote(PromotionOffer offer, Expression parent)
Promote this expression if possible
booleanreplaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

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

Parameters: value the integer value to be tested to see if it is in the range min to max inclusive min the lowest permitted value max the highest permitted value

Method Detail

computeCardinality

public int computeCardinality()
Determine the static cardinality

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

evaluateItem

public Item evaluateItem(XPathContext c)
Evaluate the expression

explain

public void explain(ExpressionPresenter destination)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getItemType

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

Parameters: th the type hierarchy cache

getMaxValueExpression

public Expression getMaxValueExpression()
Get the expression denoting the end of the range

Returns: the expression denoting the maximum value

getMinValueExpression

public Expression getMinValueExpression()
Get the expression denoting the start of the range

Returns: the expression denoting the minumum value

getValueExpression

public Expression getValueExpression()
Get the value to be tested

Returns: the expression that evaluates to the value being tested

iterateSubExpressions

public Iterator<Expression> 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(ExpressionVisitor visitor, 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: visitor an expression visitor 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: XPathException if an error is discovered during this phase (typically a type error)

promote

public Expression promote(PromotionOffer offer, Expression parent)
Promote this expression if possible

replaceSubExpression

public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression

Parameters: original the original subexpression replacement the replacement subexpression

Returns: true if the original subexpression is found

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression