inria.meije.rc.sugarcubes
Interface JavaArgumentsExpression
- All Superinterfaces:
- JavaExpression, java.io.Serializable
- All Known Implementing Classes:
- JavaArgumentsValue
- public interface JavaArgumentsExpression
- extends JavaExpression
This interface needs to be implemented by the SugarCubes programmer to perform the evaluation of an expression that the result is an array of Arguments
.
While executing, SugarCubes programs often needs to do some modifications to the state of some Java objects on which it is intend to operate. Those data processing operations in SugarCubes are handled by atomic operations.
Some of those atomic operations are performed to compute values at run-time, which are needed to parameterize the execution of some reactive instructions. For example, one wants to get an integer value at run-time to know how many iterations a repeat instruction has to do. Those atomic operations returning a value used in a reactive program are called atomic expressions
The JavaArgumentsExpression interface needs to be implemented by the programmer to implement Java computation at run-time of an array of Argument objects.
This kind of atomic expression is usually used by the generate
instruction to produce a valued occurrence of an event. The array of Argument computed at run-time is used as the set of values associated to the occurrence of the generated event.
Method Summary |
Argument[] |
evaluate(java.lang.Object self,
LocalVariables vars,
ReactiveEngine engine)
This method needs to be implemented by the SugarCubes programmer to perform run-time atomic computation of an array of Argument objects. |
evaluate
public Argument[] evaluate(java.lang.Object self,
LocalVariables vars,
ReactiveEngine engine)
- This method needs to be implemented by the SugarCubes programmer to perform run-time atomic computation of an array of Argument objects.
When computed, the array is returned by the evaluate method.
The first argument passed to this method when the atomic expression needs to be executed by the reactive program is the java object to which the reactive program is bound. This is probably the most important argument which allows one to get a first reference to an object (the one associated by an enclosing Cube
) in the Java environment of a reactive program.
The second argument is a reference to the linked list of local variables defined in the reactive program.
The last argument is a reference to the reactive execution environment allowing special manipulations such as:
- accessing super cubes in the hierarchy of nested Cubes of a reactive program;
- adding new programs in parallel in the reactive machine (real adding is performed at the next instant).
- generation of events (performed at the next instant).
- etc.