Interface VariableDeclarations
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
InstancesHelper,NoVariables,SimpleVariableDeclarations,StatsHelper,VariableDeclarationsCompositor
public interface VariableDeclarations extends java.io.SerializableInterface to expose variables to a program. It is deliberately kept very simple to give as little constraints as possible to implementations. There is an implied invariant here:hasVariable(String)== true ->getVariable(String)!= nullhasVariable(String)should be pure i.e. have no side effects. WhereasgetVariable(String)may have side effects. (This is useful for creating variables on the fly ingetVariable(String))- Version:
- $Revision: 1000 $
- Author:
- Benjamin Weber ( benweber at student dot ethz dot ch )
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NodegetVariable(java.lang.String name)Tries to fetch a variablebooleanhasVariable(java.lang.String name)Whether the variable is declared
-
-
-
Method Detail
-
hasVariable
boolean hasVariable(java.lang.String name)
Whether the variable is declared- Parameters:
name- name of the variable being queried- Returns:
- whether the variable is declared
-
getVariable
Node getVariable(java.lang.String name)
Tries to fetch a variable Before a variable is fetched it should be checked whether it is declared throughhasVariable(String).- Parameters:
name- name of the variable to be fetched- Returns:
- an AST (abstract syntax tree) node representing the variable
-
-