Class CoreOperation
java.lang.Object
org.apache.commons.jxpath.ri.compiler.Expression
org.apache.commons.jxpath.ri.compiler.Operation
org.apache.commons.jxpath.ri.compiler.CoreOperation
- Direct Known Subclasses:
CoreOperationAdd,CoreOperationAnd,CoreOperationCompare,CoreOperationDivide,CoreOperationMod,CoreOperationMultiply,CoreOperationNegate,CoreOperationOr,CoreOperationRelationalExpression,CoreOperationSubtract,CoreOperationUnion
The common subclass for tree elements representing core operations like "+", "- ", "*" etc.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.jxpath.ri.compiler.Expression
Expression.PointerIterator, Expression.ValueIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intAdd/subtract precedenceprotected static final intAnd precedenceprotected static final intCompare precedenceprotected static final intMultiply/divide/mod precedenceprotected static final intNegate precedenceprotected static final intOr precedenceprotected static final intRelational expression precedenceprotected static final intUnion precedenceFields inherited from class org.apache.commons.jxpath.ri.compiler.Expression
NOT_A_NUMBER, ONE, ZERO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompute(EvalContext context) Evaluates the expression.abstract ObjectcomputeValue(EvalContext context) Evaluates the expression.protected abstract intComputes the precedence of the operation.abstract StringReturns the XPath symbol for this operation, e.g. "+", "div", etc.protected abstract booleanReturns true if the operation is not sensitive to the order of arguments, e.g. "=", "and" etc, and false if it is, e.gtoString()Methods inherited from class org.apache.commons.jxpath.ri.compiler.Operation
computeContextDependent, getArgumentsMethods inherited from class org.apache.commons.jxpath.ri.compiler.Expression
isContextDependent, iterate, iteratePointers
-
Field Details
-
OR_PRECEDENCE
Or precedence- See Also:
-
AND_PRECEDENCE
And precedence- See Also:
-
COMPARE_PRECEDENCE
Compare precedence- See Also:
-
RELATIONAL_EXPR_PRECEDENCE
Relational expression precedence- See Also:
-
ADD_PRECEDENCE
Add/subtract precedence- See Also:
-
MULTIPLY_PRECEDENCE
Multiply/divide/mod precedence- See Also:
-
NEGATE_PRECEDENCE
Negate precedence- See Also:
-
UNION_PRECEDENCE
Union precedence- See Also:
-
-
Constructor Details
-
CoreOperation
Constructs a new CoreOperation.- Parameters:
args- Expression[]
-
-
Method Details
-
compute
Description copied from class:ExpressionEvaluates the expression. If the result is a node set, returns the first element of the node set.- Specified by:
computein classExpression- Parameters:
context- evaluation context- Returns:
- Object
-
computeValue
Description copied from class:ExpressionEvaluates the expression. If the result is a node set, returns the first element of the node set.- Specified by:
computeValuein classExpression- Parameters:
context- evaluation context- Returns:
- Object
-
getPrecedence
Computes the precedence of the operation.- Returns:
- int precedence
-
getSymbol
Returns the XPath symbol for this operation, e.g. "+", "div", etc.- Returns:
- String symbol
-
isSymmetric
Returns true if the operation is not sensitive to the order of arguments, e.g. "=", "and" etc, and false if it is, e.g. "<=", "div".- Returns:
- boolean
-
toString
-