edu.ksu.cis.projects.bogor.symboltable
Class FSMSymbolTable

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.symboltable.FSMSymbolTable
All Implemented Interfaces:
Disposable, Serializable

public final class FSMSymbolTable
extends Object
implements Disposable, Serializable

This class is used as a symbol table for a FSM.

Version:
CVS $Revision: 1.13 $ $Date: 2005/05/26 18:23:15 $
Author:
Robby , Matt Hoosier
See Also:
Serialized Form

Constructor Summary
FSMSymbolTable(SymbolTable symbolTable, FSM fsm)
          Default constructor.
 
Method Summary
 void dispose()
          Removes references to symbolTable, fsm, returnType, and clears parameterTypes, localTable, localDefTable, localIndexTable, locationDefTable, locationDescTable, liveSetTable, expTable, catchTable, errors, warnings.
 void finishTypeChecking()
          Sets the symbol table for finishing type checking FSMs.
 void finishTypeCheckingHeaders()
          Sets the symbol table for finishing type checking FSM headers.
 IntObjectTable<ArrayList<Object>> getCatchTable()
          Gets the location desc (int) to the throwables that it can catch (ArrayList<RecordType::String::NextState>) mapping.
 List<FileMessage> getErrors()
          Gets the error messages.
 FSM getFSM()
          Gets the FSM's AST.
 String getInitialLocation()
          Gets the initial location for this FSM.
 IntObjectTable<BitSet> getLiveSetTable()
          Gets the location desc (int) to its live set (int[]) mapping.
 Map<String,AbstractLocal> getLocalDefTable()
          Gets the local identifier (String) to its definition (Local or Param) mapping.
 ObjectIntTable<String> getLocalIndexTable()
          Gets the local identifier (String) to its index (int) mapping.
 Map<String,Type> getLocalTable()
          Gets the local identifier (String) to its type (Type) mapping.
 BitSet getLocalTransientFlags()
          Gets the set of flags indicating whether the local at each offset is transient (omitted from state vector).
 ArrayList<Type> getLocalTypes()
          Gets the FSM's local types
 Map<String,Location> getLocationDefTable()
          Gets the location identifier (String) to its definition (Location) mapping.
 ObjectIntTable<String> getLocationDescTable()
          Gets the location identifier (String) to its descriptor (int) mapping.
 ArrayList<Type> getParameterTypes()
          Gets the FSM's parameter types.
 Type getReturnType()
          Gets the FSM's return type.
 SymbolTable getSymbolTable()
          Gets the symbol table.
 List<FileMessage> getWarnings()
          Gets the warning messages.
 void initTypeChecking()
          Sets the symbol table for type checking FSMs.
 void initTypeCheckingHeaders()
          Sets the symbol table for type checking FSM headers.
 void setInitialLocation(String newInitialLocation)
          Sets the initial location for this FSM.
 void setParameterTypes(ArrayList<Type> newParameterTypes)
          Sets the FSM's parameter types.
 void setReturnType(Type newReturnType)
          Sets the FSM's return type.
 String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FSMSymbolTable

public FSMSymbolTable(SymbolTable symbolTable,
                      FSM fsm)
Default constructor.

Parameters:
symbolTable - The symbol table of the BIR system. Must be non-null.
fsm - The FSM's AST. Must be non-null.
Method Detail

getCatchTable

public IntObjectTable<ArrayList<Object>> getCatchTable()
Gets the location desc (int) to the throwables that it can catch (ArrayList<RecordType::String::NextState>) mapping.

Returns:
The location desc (int) to the throwables that it can catch (ArrayList<RecordType::String::NextState>) mapping. Non-null (stage >= 3).

getErrors

public List<FileMessage> getErrors()
Gets the error messages.

Returns:
The util.FileMessage error messages. Non-null (stage >= 0).

getFSM

public FSM getFSM()
Gets the FSM's AST.

Returns:
The FSM's AST. Non-null.

setInitialLocation

public void setInitialLocation(String newInitialLocation)
Sets the initial location for this FSM.

Parameters:
newInitialLocation - The new initial location id for this FSM. Must be non-null.

getInitialLocation

public String getInitialLocation()
Gets the initial location for this FSM.

Returns:
The initial location id for this FSM. Non-null (stage >=4).

getLiveSetTable

public IntObjectTable<BitSet> getLiveSetTable()
Gets the location desc (int) to its live set (int[]) mapping. Non-null (stage >= 3).

Returns:
The location desc (int) to its live set (int[]) mapping. Non-null (stage >= 3).

getLocalDefTable

public Map<String,AbstractLocal> getLocalDefTable()
Gets the local identifier (String) to its definition (Local or Param) mapping.

Returns:
The local identifier (String) to its definition (Local or Param) mapping. Non-null (stage >= 1).

getLocalIndexTable

public ObjectIntTable<String> getLocalIndexTable()
Gets the local identifier (String) to its index (int) mapping.

Returns:
The local identifier (String) to its index (int) mapping. Non-null (stage >= 1).

getLocalTable

public Map<String,Type> getLocalTable()
Gets the local identifier (String) to its type (Type) mapping.

Returns:
The local identifier (String) to its type (Type) mapping. Non-null (stage >= 1).

getLocalTransientFlags

public BitSet getLocalTransientFlags()
Gets the set of flags indicating whether the local at each offset is transient (omitted from state vector).

Returns:
A BitSet in which get(i) tells whether the stack-allocated variable at offset i is transient. Non-null (stage >= 1).

getLocalTypes

public ArrayList<Type> getLocalTypes()
Gets the FSM's local types

Returns:
The FSM's local types ordered by declaration. Non-null.

getLocationDefTable

public Map<String,Location> getLocationDefTable()
Gets the location identifier (String) to its definition (Location) mapping. Non-null (stage >= 3).

Returns:
The location identifier (String) to its definition (Location) mapping. Non-null (stage >= 3).

getLocationDescTable

public ObjectIntTable<String> getLocationDescTable()
Gets the location identifier (String) to its descriptor (int) mapping. Non-null (stage >= 3).

Returns:
The location identifier (String) to its descriptor (int) mapping. Non-null (stage >= 3).

setParameterTypes

public void setParameterTypes(ArrayList<Type> newParameterTypes)
Sets the FSM's parameter types.

Parameters:
newParameterTypes - The parameter types of the FSM. Must be non-null. Each element must be instance of Type

getParameterTypes

public ArrayList<Type> getParameterTypes()
Gets the FSM's parameter types.

Returns:
The FSM's parameter types. Non-null (stage >= 2).

setReturnType

public void setReturnType(Type newReturnType)
Sets the FSM's return type.

Parameters:
newReturnType - The return type of the FSM. Must be non-null.

getReturnType

public Type getReturnType()
Gets the FSM's return type.

Returns:
The FSM's return type.

getSymbolTable

public SymbolTable getSymbolTable()
Gets the symbol table.

Returns:
The symbol table. Non-null (stage >= 0).

getWarnings

public List<FileMessage> getWarnings()
Gets the warning messages.

Returns:
The util.FileMessage warning messages. Non-null (stage >= 0).

dispose

public void dispose()
Removes references to symbolTable, fsm, returnType, and clears parameterTypes, localTable, localDefTable, localIndexTable, locationDefTable, locationDescTable, liveSetTable, expTable, catchTable, errors, warnings. Once called, avoid using this object.

Specified by:
dispose in interface Disposable

finishTypeChecking

public void finishTypeChecking()
Sets the symbol table for finishing type checking FSMs. stage must be three.


finishTypeCheckingHeaders

public void finishTypeCheckingHeaders()
Sets the symbol table for finishing type checking FSM headers. stage must be one.


initTypeChecking

public void initTypeChecking()
Sets the symbol table for type checking FSMs. stage must be two.


initTypeCheckingHeaders

public void initTypeCheckingHeaders()
Sets the symbol table for type checking FSM headers. stage must be zero.


toString

public String toString()
Returns the string representation of this object.

Overrides:
toString in class Object
Returns:
The string representation of this object.