|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.christopherschultz.evaluator.Expression
public abstract class Expression
An evaluatable Expression. To obtain an Expression, you should use the ExpressionParser class:
Expression exp = ExpressionParser.parseExpression("1 + 2 + 3 * 5");This expression can later be evaluated:
EvaluationContext ctx = ...; Object result = exp.evaluate(ctx);The expression in the example will return an Integer result.
Constructor Summary | |
---|---|
Expression()
|
Method Summary | |
---|---|
abstract void |
acceptVisitor(ExpressionVisitor visitor)
Accepts an ExpressionVisitor. |
abstract Object |
evaluate(EvaluationContext ec)
Evaluates this expression and returns the result. |
Expression |
getParent()
|
abstract List |
getSubExpressions()
Gets a flattened, depth-first traversal of the expressions in this Expression (including this Expression). |
protected void |
setParent(Expression parent)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Expression()
Method Detail |
---|
public abstract Object evaluate(EvaluationContext ec) throws EvaluationException
ec
- The context in which this expression should
be evaluated.
null
.
EvaluationException
- If there is an error evaluating
this Expression.public abstract List getSubExpressions()
public abstract void acceptVisitor(ExpressionVisitor visitor)
protected void setParent(Expression parent) throws EvaluationException
EvaluationException
public Expression getParent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |