inria.meije.rc.sugarcubes
Interface JavaBooleanExpression
- All Superinterfaces:
- JavaExpression, java.io.Serializable
- All Known Implementing Classes:
- JavaBooleanValue
- public interface JavaBooleanExpression
- extends JavaExpression
This interface needs to be implemented by the SugarCubes programmer to perform the evaluation of an expression that the result is a boolean value.
While executing, SugarCubes programs often needs to operate 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 JavaBooleanExpression interface need to be implemented by the programmer to implement Java computation at run-time of a boolean value.
This kind of atomic expression is usually used by the If instruction to make a choice between its thenbranch or its else branch. The boolean value is computed at run-time as the condition expression used by he If instruction.
- See Also:
SC.If(inria.meije.rc.sugarcubes.JavaBooleanExpression, inria.meije.rc.sugarcubes.Program, inria.meije.rc.sugarcubes.Program)
Method Summary |
boolean |
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 boolean value. |
evaluate
public boolean 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 boolean value.
When computed, the boolean value is returned by the evaluate method.
The first argument passed to this method when the atomic expression need 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.