ConForM.CoopnTools.CoKer.CoopnMgr
Class CoopnSymbolTable

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnMgr.SymbolCollection
        |
        +--ConForM.CoopnTools.CoKer.CoopnMgr.CoopnSymbolTable
All Implemented Interfaces:
java.lang.Cloneable, CoopnModuleDependency, CoopnSymbolCollectionConstants, CoopnTypeRelation

public class CoopnSymbolTable
extends SymbolCollection
implements java.lang.Cloneable

Coopn symbol table. A symbol table contains all the symbols necessary to the definition of a module. More precisely, it contains (1) every symbols defined in the module; (2) recursively every symbol used in the definitions of the symbols belonging to (1); (3) every USE and USE CONTEXT symbols defined recursively in an used module; (4) every SUBSORT and SUBTYPE symbol defined recursively in an used module.

See Also:
CoopnElement

Fields inherited from interface ConForM.CoopnTools.CoKer.CoopnMgr.CoopnSymbolCollectionConstants
ADTAXIOM, ADTTHEOREM, CLASSAXIOM, CLASSCREATION, CLASSDESTRUCTION, CLASSGATE, CLASSMETHOD, CLASSTHEOREM, CONTEXTAXIOM, CONTEXTGATE, CONTEXTMETHOD, CONTEXTTHEOREM, GENERATOR, INITIAL, METATERM, OBJECT, OPERATION, PLACE, SORT, SUBSORT, SUBTYPE, SYMBOLKINDNUMBER, TRANSITION, TYPE, USE, USECONTEXT, VARIABLE
 
Constructor Summary
CoopnSymbolTable(int size)
          Simple constructor.
 
Method Summary
 void addDefinedSymbol(CoopnSymbol symbol, boolean external, int pos)
          Add a defined symbol.
 void addUsedSymbol(CoopnSymbol symbol, boolean external, int pos)
          Add an used symbol.
 java.lang.Object clone()
           
 boolean defined(CoopnSymbol symbol)
          Look if a symbol is used or defined in the table.
 boolean equals(java.lang.Object obj)
           
 boolean external(CoopnSymbol symbol)
          Look if a symbol is external or internal in the table.
 int getIndex(CoopnSymbol symbol)
          Look in the table for a symbol.
 CoopnSymbol getSymbol(int pos)
          Look in the table for a symbol.
 int indexOf(CoopnSymbol symbol)
          Look in the table for a symbol.
 int size()
          return the size of the symbol table.
 ConForM.CoopnTools.CoKer.CoopnMgr.CoopnCocoMgr.CoopnCocoElement toCoco(CoopnSymbolTable table)
           
 java.lang.Object unmodifiableCopy()
           
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.SymbolCollection
add, cloneSymbolCollection, compatibleKind, defined, dependencies, equ, equ, external, hashCode, index, less, less, lessOrEqu, lessOrEqu, size, symbol, symbolKindNumber, symbolToKind, unifiable, unifiable, unmodifiableCollection
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoopnSymbolTable

public CoopnSymbolTable(int size)
                 throws java.lang.IllegalArgumentException
Simple constructor.
Method Detail

addUsedSymbol

public void addUsedSymbol(CoopnSymbol symbol,
                          boolean external,
                          int pos)
Add an used symbol.
Parameters:
symbol - the symbol to add
external - true iff the symbol is used in the interface
pos - the symbol index
Throws:
java.lang.IllegalArgumentException - The index in invalid or already assigned.

addDefinedSymbol

public void addDefinedSymbol(CoopnSymbol symbol,
                             boolean external,
                             int pos)
Add a defined symbol.
Parameters:
symbol - the symbol to add
external - true iff the symbol is used in the interface
pos - the symbol index
Throws:
java.lang.IllegalArgumentException - The index in invalid or already assigned.

size

public int size()
return the size of the symbol table.
Returns:
the size of the symbol table.

getSymbol

public CoopnSymbol getSymbol(int pos)
Look in the table for a symbol.
Parameters:
pos - the index
Returns:
the symbol in the table, or null if the index is not assigned.
Throws:
java.lang.IllegalArgumentException - The index in invalid.

getIndex

public int getIndex(CoopnSymbol symbol)
Look in the table for a symbol.
Parameters:
symbol - the symbol to get
Returns:
the index of the symbol in the table, or -1 if the symbol is not found.

indexOf

public int indexOf(CoopnSymbol symbol)
            throws java.lang.IllegalArgumentException
Look in the table for a symbol.
Returns:
the index of the symbol in the table.
Throws:
java.lang.IllegalArgumentException - The symbol is not found in the table.

defined

public boolean defined(CoopnSymbol symbol)
Look if a symbol is used or defined in the table.
Returns:
true iff the symbol is defined (i.e. add with adddefinedSymbol).
Throws:
java.lang.IllegalArgumentException - The symbol is not found in the table.

external

public boolean external(CoopnSymbol symbol)
Look if a symbol is external or internal in the table.
Returns:
true iff the symbol is external (i.e. member of interface).
Throws:
java.lang.IllegalArgumentException - The symbol is not found in the table.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class SymbolCollection

toCoco

public ConForM.CoopnTools.CoKer.CoopnMgr.CoopnCocoMgr.CoopnCocoElement toCoco(CoopnSymbolTable table)
                                                                       throws java.lang.IllegalArgumentException

unmodifiableCopy

public java.lang.Object unmodifiableCopy()
Overrides:
unmodifiableCopy in class SymbolCollection

clone

public java.lang.Object clone()
Overrides:
clone in class SymbolCollection