|
terp - the Codemesh Modular Template Interpreter v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Executor<T>
The interface implemented by all executors that take 0 to n arguments.
Executors are the primary abstraction for active or executable terp elements (member functions, terp global functions, terp operators, external tools). While nothing prevents you from instantiating an executor and then directly calling one of its execute() methods, execution within the terp framework is handled a bit differently.
Executors representing functions or operators have to be registered with the
terp framework via a TerpRegistrar. The framework performs this registration step
for you for the built-in operators and types. Registered xecutors are maintained
in a hashtable that maps each executor name to a list of executors. That's right,
one name can have multiple executors registered to it.
When figuring out what to do when a function or an operator is invoked with a set
of arguments, the following steps take place.
matches(List)
returns true for the invocation arguments.
execute(List) method is invoked, otherwise
nothing happens and the operation results in null.
The executors themselves are not named because each executor might be known under more than one name and this allows us to reuse the same instance in these cases.
| Nested Class Summary | |
|---|---|
static class |
Executor.AbstractExecutor<T>
A convenient base class for your own custom executors. |
static class |
Executor.ForMethod
|
| Method Summary | |
|---|---|
T |
execute(java.util.List<java.lang.Object> args)
Performs the executor's action on the given arguments. |
T |
execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
Performs the executor's action on the given arguments in the given context. |
boolean |
matches(java.util.List<java.lang.Object> args)
Returns true if the executor applies to the given arguments. |
| Method Detail |
|---|
boolean matches(java.util.List<java.lang.Object> args)
args - the arguments passed to the executor.
T execute(java.util.List<java.lang.Object> args)
execute(List,TerpEvaluator,TerpContext).
args - the arguments.
T execute(java.util.List<java.lang.Object> args,
TerpEvaluator eval,
TerpContext ctx)
args - the arguments.eval - the evaluator to use. Can frequently be null.ctx - the context in which the execution occurs. Can frequently be null.
|
terp - the Codemesh Modular Template Interpreter v1.3.304 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||