org.jaxen.expr

Interface Predicate

All Superinterfaces:
Serializable
Known Implementing Classes:
DefaultPredicate

public interface Predicate
extends Serializable

Represents an XPath predicate such as [position() = last()]. This is production 8 and 9 in the XPath 1.0 specification:
 [8] Predicate     ::= '[' PredicateExpr ']'   
 [9] PredicateExpr ::= Expr

Method Summary

Object
evaluate(Context context)
Evaluates this predicate's expression and returns the result.
Expr
getExpr()
Returns the expression in this predicate.
String
getText()
Returns the string form of the predicate, including the square brackets.
void
setExpr(Expr expr)
Change the expression used by this predicate.
void
simplify()
Simplify the expression in this predicate.

Method Details

evaluate

public Object evaluate(Context context)
            throws JaxenException
Evaluates this predicate's expression and returns the result. The result will be a java.lang.Double for expressions that return a number, a java.lang.String for expressions that return a string, a java.lang.Boolean for expressions that return a boolean, and a java.util.List for expressions that return a node-set. In the latter case, the elements of the list are the actual objects from the source document model. Copies are not made.
Parameters:
context - the context in which the expression is evaluated
Returns:
an object representing the result of the evaluation
Throws:
JaxenException -

getExpr

public Expr getExpr()
Returns the expression in this predicate.
Returns:
the expression between the brackets

getText

public String getText()
Returns the string form of the predicate, including the square brackets.
Returns:
the bracketed form of this predicate

setExpr

public void setExpr(Expr expr)
Change the expression used by this predicate.
Parameters:
expr - the new expression

simplify

public void simplify()
Simplify the expression in this predicate.