inria.meije.rc.sugarcubes
Interface LocalVariables


public interface LocalVariables

It is an interface which allows the programmer to access local variables in atomic operations.
Local variables in SugarCubes are handled as a linked list, which handles nested local variable definitions encapsulating an atomic operation. The last local variable declaration is the first element of the Linked list, which is passed as argument of the methods ÔevaluateÕ, or the method 'execute' (according to the kind of atomic operation considered) of an atomic operation.
Note: this interface should not be implemented. It is not sufficient to make local variables in SugarCubes.


Method Summary
 java.lang.Object getVariableValue(java.lang.String varName, java.lang.Class expectedType)
          This method allows one to retrieve the value of a local variable, doing some dynamic type checking.
 java.lang.Object getVariableValueNoCheck(java.lang.String varName)
          This method allows one to retrieve the value of a local variable, without type checking.
 java.lang.Object setVariableValue(java.lang.String varName, java.lang.Object value)
          This method allows one to affect a value to a local variable.
 

Method Detail

getVariableValue

public java.lang.Object getVariableValue(java.lang.String varName,
                                         java.lang.Class expectedType)
                                  throws NoSuchLocalVariable
This method allows one to retrieve the value of a local variable, doing some dynamic type checking. Local variables are identified by name, which are strings.
If the type of the local variable is not the one (or a subtype of) of the expectedType parameter, a ClassCastException is thrown.
If the variable has not been declared a NoSuchLocalVariable is thrown.

getVariableValueNoCheck

public java.lang.Object getVariableValueNoCheck(java.lang.String varName)
                                         throws NoSuchLocalVariable
This method allows one to retrieve the value of a local variable, without type checking.
If the variable has not been declared a NoSuchLocalVariable is thrown.

setVariableValue

public java.lang.Object setVariableValue(java.lang.String varName,
                                         java.lang.Object value)
                                  throws NoSuchLocalVariable
This method allows one to affect a value to a local variable.
If the value has an improper type, a ClassCastException is thrown.
If the variable has not been declared a NoSuchLocalVariable is thrown.