org.apache.commons.jxpath.ri.compiler
Class Expression

java.lang.Object
  |
  +--org.apache.commons.jxpath.ri.compiler.Expression
Direct Known 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.6 $ $Date: 2003/03/11 00:59:22 $
Author:
Dmitri Plotnikov

Inner Class Summary
static class Expression.PointerIterator
           
static class Expression.ValueIterator
           
 
Field Summary
protected static java.lang.Double NOT_A_NUMBER
           
protected static java.lang.Double ONE
           
protected static java.lang.Double ZERO
           
 
Constructor Summary
Expression()
           
 
Method Summary
abstract  java.lang.Object compute(EvalContext context)
           
abstract  boolean computeContextDependent()
          Implemented by subclasses and result is cached by isContextDependent()
abstract  java.lang.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.
 java.util.Iterator iterate(EvalContext context)
           
 java.util.Iterator iteratePointers(EvalContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

protected static final java.lang.Double ZERO

ONE

protected static final java.lang.Double ONE

NOT_A_NUMBER

protected static final java.lang.Double NOT_A_NUMBER
Constructor Detail

Expression

public Expression()
Method Detail

isContextDependent

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

computeContextDependent

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

computeValue

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

compute

public abstract java.lang.Object compute(EvalContext context)

iterate

public java.util.Iterator iterate(EvalContext context)

iteratePointers

public java.util.Iterator iteratePointers(EvalContext context)


Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.