Interface VariableDeclarations
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
InstancesHelper
,NoVariables
,SimpleVariableDeclarations
,StatsHelper
,VariableDeclarationsCompositor
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)
!= null
hasVariable(String)
should be pure i.e. have no side effects.
Whereas getVariable(String)
may have side effects.
(This is useful for creating variables on the fly in getVariable(String)
)- Version:
- $Revision: 1000 $
- Author:
- Benjamin Weber ( benweber at student dot ethz dot ch )
-
Method Summary
Modifier and TypeMethodDescriptiongetVariable
(String name) Tries to fetch a variableboolean
hasVariable
(String name) Whether the variable is declared
-
Method Details
-
hasVariable
Whether the variable is declared- Parameters:
name
- name of the variable being queried- Returns:
- whether the variable is declared
-
getVariable
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
-