org.translet.processor
Class SimplePredicateExpr

java.lang.Object
  |
  +--org.translet.processor.SimplePredicateExpr
All Implemented Interfaces:
PredicateExpr

public class SimplePredicateExpr
extends Object
implements PredicateExpr

Represents a simple expression in the predicate. A simple expression is the smallest unit of the expression. It is the expression that is found on one side of a single complete expression.

Ex: In case of the predicate in the xpath "/a/b[./c/text()=./d/text()]/e" ./c/text() is a simple xpath expression, so is the expression on the RHS of the equation.

Author:
Karthikeyan M.

Constructor Summary
SimplePredicateExpr(TokenIterator iter, LocationPathHandler handler)
          The tokens from the start to end position are the only tokens that should be processed by this simple expression.
 
Method Summary
 Object evaluate()
          Returns the name of the attribute
 boolean initialize(PredicateContext ctxt, RuleMonitor rules)
          Initializes and validates (recursively, if required) the expression and returns the status about if the expression can be evaluated.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimplePredicateExpr

public SimplePredicateExpr(TokenIterator iter,
                           LocationPathHandler handler)
The tokens from the start to end position are the only tokens that should be processed by this simple expression.
Method Detail

initialize

public boolean initialize(PredicateContext ctxt,
                          RuleMonitor rules)
Description copied from interface: PredicateExpr
Initializes and validates (recursively, if required) the expression and returns the status about if the expression can be evaluated.

The values passed on the contextNode and the rules are also the values that are to be used in evaluating the expression.

The expression is expected to return at the first place where the initialization fails. In other words, if the initialization succeeds, all the expressions were initialized, but, if it fails, not all expressions might have been evaluated.

Specified by:
initialize in interface PredicateExpr
Following copied from interface: org.translet.processor.PredicateExpr
Parameters:
context - The context for this expression.
rules - Required to make decisions when the expression is ambiguous. null, if there are no rules required.
Returns:
true if the expression can be evaluated within the context of the rules specified.

evaluate

public Object evaluate()
Returns the name of the attribute
Specified by:
evaluate in interface PredicateExpr
Following copied from interface: org.translet.processor.PredicateExpr
Returns:
The value for this expression.

toString

public String toString()
Overrides:
toString in class Object