org.apache.commons.jxpath.ri.compiler

Class Expression

Known Direct Subclasses:
Constant, Operation, Path, VariableReference

public abstract class Expression
extends java.lang.Object

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: 1.10 $ $Date: 2004/02/29 14:17:38 $
Author:
Dmitri Plotnikov

Nested Class Summary

static class
Expression.PointerIterator
static class
Expression.ValueIterator

Field Summary

protected static Double
NOT_A_NUMBER
protected static Double
ONE
protected static Double
ZERO

Method Summary

abstract Object
compute(EvalContext context)
abstract boolean
computeContextDependent()
Implemented by subclasses and result is cached by isContextDependent()
abstract Object
computeValue(EvalContext context)
Evaluates the expression.
boolean
isContextDependent()
Returns true if this expression should be re-evaluated each time the current position in the context changes.
Iterator
iterate(EvalContext context)
Iterator
iteratePointers(EvalContext context)

Field Details

NOT_A_NUMBER

protected static final Double NOT_A_NUMBER

ONE

protected static final Double ONE

ZERO

protected static final Double ZERO

Method Details

compute

public abstract Object compute(EvalContext context)

computeContextDependent

public abstract boolean computeContextDependent()
Implemented by subclasses and result is cached by isContextDependent()

computeValue

public abstract Object computeValue(EvalContext context)
Evaluates the expression. If the result is a node set, returns the first element of the node set.

isContextDependent

public boolean isContextDependent()
Returns true if this expression should be re-evaluated each time the current position in the context changes.

iterate

public Iterator iterate(EvalContext context)

iteratePointers

public Iterator iteratePointers(EvalContext context)