Class Expression

java.lang.Object
org.apache.commons.jxpath.ri.compiler.Expression
Direct Known Subclasses:
Constant, Operation, Path, VariableReference

public abstract class Expression extends 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.
  • Field Details Link icon

  • Constructor Details Link icon

    • Expression Link icon

      public Expression()
      Constructs a new instance.
  • Method Details Link icon

    • compute Link icon

      public abstract Object compute(EvalContext context)
      Evaluates the expression. If the result is a node set, returns the first element of the node set.
      Parameters:
      context - evaluation context
      Returns:
      Object
    • computeContextDependent Link icon

      public abstract boolean computeContextDependent()
      Implemented by subclasses and result is cached by isContextDependent()
      Returns:
      calculated context-dependentness as boolean
    • computeValue Link icon

      public abstract Object computeValue(EvalContext context)
      Evaluates the expression. If the result is a node set, returns the first element of the node set.
      Parameters:
      context - evaluation context
      Returns:
      Object
    • isContextDependent Link icon

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

      public Iterator iterate(EvalContext context)
      Iterate over the values from the specified context.
      Parameters:
      context - evaluation context
      Returns:
      value Iterator
    • iteratePointers Link icon

      Iterate over the pointers from the specified context.
      Parameters:
      context - evaluation context
      Returns:
      pointer Iterator