Class Expression
java.lang.Object
org.apache.commons.jxpath.ri.compiler.Expression
- Direct Known Subclasses:
Constant
,Operation
,Path
,VariableReference
Common superclass for several types of nodes in the parse tree. Provides
APIs for optimization of evaluation of expressions. Specifically, an
expression only needs to executed once during the evaluation of an xpath
if that expression is context-independent. Expression.isContextDependent()
provides that hint.
- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Pointer iteratorstatic class
Value Iterator -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
compute
(EvalContext context) Evaluates the expression.abstract boolean
Implemented by subclasses and result is cached by isContextDependent()abstract Object
computeValue
(EvalContext context) Evaluates the expression.boolean
Returns true if this expression should be re-evaluated each time the current position in the context changes.iterate
(EvalContext context) Iterate over the values from the specified context.iteratePointers
(EvalContext context) Iterate over the pointers from the specified context.
-
Field Details
-
ZERO
zero -
ONE
one -
NOT_A_NUMBER
NaN -
contextDependencyKnown
private boolean contextDependencyKnown -
contextDependent
private boolean contextDependent
-
-
Constructor Details
-
Expression
public Expression()
-
-
Method Details
-
isContextDependent
public boolean isContextDependent()Returns true if this expression should be re-evaluated each time the current position in the context changes.- Returns:
- boolean
-
computeContextDependent
public abstract boolean computeContextDependent()Implemented by subclasses and result is cached by isContextDependent()- Returns:
- calculated context-dependentness as boolean
-
computeValue
Evaluates the expression. If the result is a node set, returns the first element of the node set.- Parameters:
context
- evaluation context- Returns:
- Object
-
compute
Evaluates the expression. If the result is a node set, returns the first element of the node set.- Parameters:
context
- evaluation context- Returns:
- Object
-
iterate
Iterate over the values from the specified context.- Parameters:
context
- evaluation context- Returns:
- value Iterator
-
iteratePointers
Iterate over the pointers from the specified context.- Parameters:
context
- evaluation context- Returns:
- pointer Iterator
-