public interface Evaluator
Expression
.
Similar to the Parser
building up an expression-tree-hirarchy from
a given String
, the method Expression.getEvaluator(Type,Context)
of an Expression
(representing that expression-tree-hirarchy) builds
up an evaluator-tree-hirarchy in a kind of recursion and returns it as an
Evaluator
object.Modifier and Type | Method and Description |
---|---|
Object |
evaluate()
Evaluate an
Expression and return the result as an
Object . |
Type |
getReturnType()
Return the
Type of the evaluated Object . |
Object evaluate()
Expression
and return the result as an
Object
.
Attention: The returned Object
and the result
Object
storing in a field by this Evaluator
are the same. If you need a new instance for the result, you have to assign
the returned value to a new one. If the type of the evaluation result is
known, you can also use the get...Value(...)
method of your
current Evaluator
to assign the evaluation result to a given
Object
of the same type, for example:
//anExpressionConfiguration
with name "config" was defined and //anExpression
was already setted. AbstractRealEvaluator e=(AbstractRealEvaluator)config.getEvaluator(); e.evaluate(); Real r=new Real(); e.getRealValue(r);
Type getReturnType()
Type
of the evaluated Object
.Type
of the evaluation result.