com.plotnix.jex.adapters
Class InterpretedExpression
java.lang.Object
|
+--com.plotnix.jex.adapters.InterpretedExpression
- All Implemented Interfaces:
- Expression, IterationExpression, VariableExpression
- public class InterpretedExpression
- extends java.lang.Object
- implements Expression, IterationExpression, VariableExpression
A wrapper for an expression string associated with an interpreter.
When asked to evaluate itself, an InterpreterExpression
passes the expression string to the interpreter for evaluation.
- Version:
- $Revision$
- Author:
- Dmitri Plotnikov
Method Summary |
void |
assign(Context context,
java.lang.Object value,
java.lang.Object[] arguments)
Modifies a value in the specified context according to the
expression and the supplied arguments. |
java.lang.Object |
evaluate(Context context,
java.lang.Object[] arguments)
Produces the value described by the expression in the
specified context with the supplied arguments. |
java.lang.Object |
evaluate(Context context,
java.lang.Object[] arguments,
java.lang.Class valueType)
Evaluates the expression and casts the result to the supplied type. |
java.util.Iterator |
iterate(Context context,
java.lang.Object[] arguments)
Produces the iterator described by the expression in the
specified context with the supplied arguments. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InterpretedExpression
public InterpretedExpression(Interpreter interpreter,
java.lang.String expression)
- Parameters:
interpreter
- is the interpreter for the expression languageexpression
- is the expression to be interpreted
evaluate
public java.lang.Object evaluate(Context context,
java.lang.Object[] arguments)
- Description copied from interface:
Expression
- Produces the value described by the expression in the
specified context with the supplied arguments.
- Specified by:
evaluate
in interface Expression
- See Also:
Expression.evaluate(Context, Object[])
evaluate
public java.lang.Object evaluate(Context context,
java.lang.Object[] arguments,
java.lang.Class valueType)
- Description copied from interface:
Expression
- Evaluates the expression and casts the result to the supplied type.
- Specified by:
evaluate
in interface Expression
- See Also:
Expression.evaluate(Context, Object[], Class)
iterate
public java.util.Iterator iterate(Context context,
java.lang.Object[] arguments)
- Description copied from interface:
IterationExpression
- Produces the iterator described by the expression in the
specified context with the supplied arguments.
- Specified by:
iterate
in interface IterationExpression
- See Also:
IterationExpression.iterate(Context, Object[])
assign
public void assign(Context context,
java.lang.Object value,
java.lang.Object[] arguments)
- Description copied from interface:
VariableExpression
- Modifies a value in the specified context according to the
expression and the supplied arguments. Casts the type of
the value if necessary.
- Specified by:
assign
in interface VariableExpression
- See Also:
VariableExpression.assign(Context, Object, Object[])
Copyright (c) 2002 - Plotnix, Inc