org.translet.processor
Class CompoundPredicateExpr

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

public class CompoundPredicateExpr
extends Object
implements PredicateExpr

Represents a compound expression involving xpath expressions. This is a composite of PredicateExpr. A compound expression can be made up of two other PredicateExpr (either or both of which can also be another CompoundPredicateExpr).

Author:
Karthikeyan M.

Constructor Summary
CompoundPredicateExpr(PredicateExpr left, String operator, PredicateExpr right)
           
 
Method Summary
 Object evaluate()
          Evaluates the expression and returns the value.
 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

CompoundPredicateExpr

public CompoundPredicateExpr(PredicateExpr left,
                             String operator,
                             PredicateExpr right)
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()
Description copied from interface: PredicateExpr
Evaluates the expression and returns the value.
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