edu.toronto.cs.gclang.parser
Class VariableTable

java.lang.Object
  extended by edu.toronto.cs.gclang.parser.VariableTable

public class VariableTable
extends java.lang.Object

Describe class VariableTable here. Symbol table that keeps track of variables. Since we often need several copies of the same variable, for example, current and next state, or even next next state, we support arbitrary number of shadow variables.

Version:
1.0
Author:
Arie Gurfinkel

Nested Class Summary
 class VariableTable.DefineVariable
           
 class VariableTable.EnumeratedVariable
           
 class VariableTable.StateVariable
           
 class VariableTable.Variable
           
 
Constructor Summary
VariableTable()
           
VariableTable(int _shadows)
          Creates a new VariableTable instance.
 
Method Summary
 VariableTable.DefineVariable declareDefine(java.lang.String name, MvSet value)
          Describe declareDefine method here.
 VariableTable.EnumeratedVariable declareEnumerated(java.lang.String name, java.util.Collection values)
          declareEnumerated declares a variable of enumerated type
 VariableTable.EnumeratedVariable declareEnumerated(java.lang.String name, java.lang.String[] values)
          declareEnumerated declares a variable of enumerated type
 VariableTable.StateVariable declarePropositional(java.lang.String name)
          Describe declarePropositional method here.
 void dump()
           
 VariableTable.Variable getByName(java.lang.String name)
           
 CTLReWriter getCtlReWriter()
           
 MvSetFactory getMvSetFactory()
           
 int getNumVars()
           
 StatePresenter getStatePresenter()
           
 int[] getVariableIds(int set)
          Describe getVariableIds method here.
 java.util.Collection getVariables()
           
 java.lang.String[] getVarNames()
          Describe getVarNames method here.
 CTLNode handleUnknownVariable(java.lang.String name)
           
 void setMvSetFactory(MvSetFactory _factory)
           
 java.lang.String toString()
           
 int[] variableMap(int fromSet, int toSet)
          Describe variableMap method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableTable

public VariableTable(int _shadows)
Creates a new VariableTable instance.

Parameters:
_shadows - an int number of shadow variables

VariableTable

public VariableTable()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setMvSetFactory

public void setMvSetFactory(MvSetFactory _factory)

getMvSetFactory

public MvSetFactory getMvSetFactory()

declareDefine

public VariableTable.DefineVariable declareDefine(java.lang.String name,
                                                  MvSet value)
Describe declareDefine method here.

Parameters:
name - a String value
value - a MvSet value
Returns:
a DefineVariable value

declareEnumerated

public VariableTable.EnumeratedVariable declareEnumerated(java.lang.String name,
                                                          java.util.Collection values)
declareEnumerated declares a variable of enumerated type

Parameters:
name - a String value
values - a Collection values for the enumeration
Returns:
an EnumeratedVariable value

declareEnumerated

public VariableTable.EnumeratedVariable declareEnumerated(java.lang.String name,
                                                          java.lang.String[] values)
declareEnumerated declares a variable of enumerated type

Parameters:
name - a String value
values - a String[] values for the enumeration
Returns:
an EnumeratedVariable value

declarePropositional

public VariableTable.StateVariable declarePropositional(java.lang.String name)
Describe declarePropositional method here.

Parameters:
name - a String value
Returns:
a StateVariable value

getNumVars

public int getNumVars()

getByName

public VariableTable.Variable getByName(java.lang.String name)

getVariables

public java.util.Collection getVariables()

getVarNames

public java.lang.String[] getVarNames()
Describe getVarNames method here. currently called to construct a KripkeStructure but not used there.

Returns:
a String[] value

dump

public void dump()

handleUnknownVariable

public CTLNode handleUnknownVariable(java.lang.String name)

getCtlReWriter

public CTLReWriter getCtlReWriter()

getStatePresenter

public StatePresenter getStatePresenter()

variableMap

public int[] variableMap(int fromSet,
                         int toSet)
Describe variableMap method here. returns an integer array that maps variables in the 'fromSet' to variables in the 'toSet'. For example, variableMap (0, 1) returns a map that maps 0 variables to 1 variables. The intention is that 0 variables are current variables, and 1 variables are next state variables, in which case we get a map from current to next state

Parameters:
fromSet - an int value
toSet - an int value
Returns:
an int[] value

getVariableIds

public int[] getVariableIds(int set)
Describe getVariableIds method here. returns ids of all of the variables in set set

Parameters:
set - an int value
Returns:
an int[] value