Interface VariableDeclarations
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
InstancesHelper,NoVariables,SimpleVariableDeclarations,StatsHelper,VariableDeclarationsCompositor
public interface VariableDeclarations extends Serializable
Interface 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(String name)Tries to fetch a variablebooleanhasVariable(String name)Whether the variable is declared
-
-
-
Method Detail
-
hasVariable
boolean hasVariable(String name)
Whether the variable is declared- Parameters:
name- name of the variable being queried- Returns:
- whether the variable is declared
-
getVariable
Node getVariable(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
-
-