Executor Interface
- public interface Executor
The Executor interface is implemented by a class
that can perform the Unification-Validation-Evaluation cycle on an Expression.
execute(Expression, Unifier, Validator, Evaluator) Method
public Object
execute(Expression
expression,
Unifier
unifier,
Validator
validator,
Evaluator
evaluator)
throws IllegalArgumentException
, ExpressionException
Executes the supplied expression in a stateless/stateful mode depending
on the supplied evaluator.
The algorithm, for execution is as follows.
UNIFICATION
1. Unify the supplied expression if the supplied unifier is not null,
otherwise ignore unification.
VALIDATION
2. Validate the supplied expression if the supplied validator is not null,
otherwise ignore validation.
EVALUATION
3. If the supplied evaluator is not null, then the supplied expression is evaluated
in the stateful or stateless mode depending on the type of the supplied evaluator.
3a. If the supplied evaluator is null then throw IllegalArgumentException.
4. Return the result.
Note: IF STATELESS EVALUATOR IS PASSED THEN UNIFIER SHOULD BE NULL.
Parameters
-
expression
- An
Expression
to be evaluated.
-
unifier
- The
Unifier
that can unify the supplied
expression.
-
validator
- The
Validator
that can validate the supplied
expression.
-
evaluator
- The
Evaluator
that can evaluate/execute
the supplied expression.
Returns
- The result of executing the supplied expression.
Exceptions
-
IllegalArgumentException
- If the supplied evaluator is
null
.
-
ExpressionException
- If an error occurs during the execution of the supplied
expression.
Related Topics
Expression
Unifier
Validator
Evaluator