|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.expr.BinaryExpression net.sf.saxon.expr.ArithmeticExpression
public class ArithmeticExpression
Arithmetic Expression: an expression using one of the operators
plus, minus, multiply, div, idiv, mod. Note that this code does not handle backwards
compatibility mode: see ArithmeticExpression10
Field Summary | |
---|---|
protected boolean |
simplified
|
Fields inherited from class net.sf.saxon.expr.BinaryExpression |
---|
operand0, operand1, operator |
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD |
Constructor Summary | |
---|---|
ArithmeticExpression(Expression p0,
int operator,
Expression p1)
Create an arithmetic expression |
Method Summary | |
---|---|
static AtomicValue |
compute(AtomicValue value0,
int operator,
AtomicValue value1,
XPathContext context)
Static method to apply arithmetic to two values |
Expression |
copy()
Copy an expression. |
Item |
evaluateItem(XPathContext context)
Evaluate the expression. |
Calculator |
getCalculator()
Get the calculator allocated to evaluate this expression |
String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user. |
IntegerValue[] |
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get a lower and upper bound on the values of the integers that may be returned, from static analysis. |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the expression, insofar as this is known statically |
static int |
mapOpCode(int op)
Map operator codes from those in the Token class to those in the Calculator class |
Expression |
simplify(ExpressionVisitor visitor)
Simplify an expression |
Expression |
typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
Type-check the expression statically. |
Methods inherited from class net.sf.saxon.expr.BinaryExpression |
---|
computeCardinality, computeSpecialProperties, displayOperator, equals, explain, explainExtraAttributes, getArguments, getOperands, getOperator, hashCode, isAssociative, isCommutative, isInverse, iterateSubExpressions, optimize, promote, replaceSubExpression, setFlattened, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean simplified
Constructor Detail |
---|
public ArithmeticExpression(Expression p0, int operator, Expression p1)
p0
- the first operandoperator
- the operator, for example Token.PLUS
p1
- the second operandMethod Detail |
---|
public String getExpressionName()
getExpressionName
in class Expression
public Expression simplify(ExpressionVisitor visitor) throws XPathException
BinaryExpression
simplify
in class BinaryExpression
visitor
- an expression visitor
XPathException
- if an error is discovered during expression
rewritingpublic Calculator getCalculator()
public Expression typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
typeCheck
in class BinaryExpression
visitor
- an expression visitorcontextItemType
- 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
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public IntegerValue[] getIntegerBounds()
getIntegerBounds
in class Expression
public Expression copy()
copy
in class Expression
public static AtomicValue compute(AtomicValue value0, int operator, AtomicValue value1, XPathContext context) throws XPathException
value0
- the first valueoperator
- the operator as denoted in the Calculator class, for example Calculator.PLUS
value1
- the second valuecontext
- the XPath dynamic evaluation context
XPathException
public static int mapOpCode(int op)
op
- an operator denoted by a constant in the Token
class, for example Token.PLUS
Calculator
class, for example
Calculator.PLUS
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Expression
th
- the type hierarchy cache
public Item evaluateItem(XPathContext context) throws XPathException
evaluateItem
in class Expression
context
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expression
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |