ConForM.CoopnTools.CoKer.CoopnMgr
Class SymbolCollection

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

public abstract class SymbolCollection
extends java.lang.Object
implements CoopnSymbolCollectionConstants, CoopnModuleDependency, CoopnTypeRelation

Collection of coopn symbols.

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
protected SymbolCollection()
          Simple constructor.
 
Method Summary
protected  int add(CoopnSymbol symbol, boolean defined, boolean external)
          Add a symbol.
abstract  java.lang.Object clone()
           
protected  SymbolCollection cloneSymbolCollection()
           
static boolean compatibleKind(int kind1, int kind2)
          decide if a symbol kind is compatible with another one.
 boolean defined(int index, int kind)
          get the defined status of a symbol.
 java.lang.String[] dependencies()
          Module dependency.
 boolean equ(CoopnTypeAgg left, CoopnTypeAgg right)
          Equivalence between two lists of types.
 boolean equ(CoopnType left, CoopnType right)
          Equivalence between two types.
 boolean equals(java.lang.Object obj)
           
 boolean external(int index, int kind)
          get the external status of a symbol.
 int hashCode()
           
protected  int index(CoopnSymbol symbol)
          get the integer associated to a symbol.
 boolean less(CoopnTypeAgg sub, CoopnTypeAgg sup)
          Order between two lists of types.
 boolean less(CoopnType sub, CoopnType sup)
          Order between two types.
 boolean lessOrEqu(CoopnTypeAgg sub, CoopnTypeAgg sup)
          Order between two lists of types.
 boolean lessOrEqu(CoopnType sub, CoopnType sup)
          Order between two types.
 int size(int kind)
          get the number of symbols of a particular kind.
 CoopnSymbol symbol(int index, int kind)
          get a symbol.
 int symbolKindNumber()
           
 int symbolToKind(CoopnSymbol s)
           
 boolean unifiable(CoopnTypeAgg left, CoopnTypeAgg right)
          Compatibility for unification between two lists of types.
 boolean unifiable(CoopnType left, CoopnType right)
          Compatibility for unification between two types.
protected  SymbolCollection unmodifiableCollection()
           
abstract  java.lang.Object unmodifiableCopy()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolCollection

protected SymbolCollection()
                    throws java.lang.IllegalArgumentException
Simple constructor.
Method Detail

symbolKindNumber

public int symbolKindNumber()

symbolToKind

public int symbolToKind(CoopnSymbol s)

add

protected int add(CoopnSymbol symbol,
                  boolean defined,
                  boolean external)
Add a symbol.
Parameters:
symbol - the symbol to add
defined - true iff the symbol is defined
external - true iff the symbol is exported
Returns:
an integer associated to the symbol. This integer, along with the type of the symbol, identifies the symbol in the collection.

index

protected int index(CoopnSymbol symbol)
get the integer associated to a symbol.
Parameters:
symbol - the symbol to add
Returns:
the integer associated to the symbol, or -1 of the symbol is not in the table.

size

public int size(int kind)
get the number of symbols of a particular kind.
Parameters:
kind - the symbol kind
Returns:
the number of symbols of a particular kind

compatibleKind

public static boolean compatibleKind(int kind1,
                                     int kind2)
decide if a symbol kind is compatible with another one. A symbol is compatible with another one if it can reasonably be used instead of the other. This function cares about the kind of the symbol only.
Parameters:
kind1 - the original symbol
kind2 - the symbol to test
Returns:
true iff kind2 is compatible with kind1 (and therefore, any symbol of kind kind2 have a chance to be compatible with any symbols of kind kind1).

symbol

public CoopnSymbol symbol(int index,
                          int kind)
get a symbol.
Parameters:
index - the integer associated to the symbol
kind - the symbol kind
Returns:
the symbol.

defined

public boolean defined(int index,
                       int kind)
get the defined status of a symbol.
Parameters:
index - the integer associated to the symbol
kind - the symbol kind
Returns:
the defined status of the symbol.

external

public boolean external(int index,
                        int kind)
get the external status of a symbol.
Parameters:
index - the integer associated to the symbol
kind - the symbol kind
Returns:
the external status of the symbol.

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

dependencies

public java.lang.String[] dependencies()
Description copied from interface: CoopnModuleDependency
Module dependency.
Specified by:
dependencies in interface CoopnModuleDependency
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnModuleDependency
Returns:
an array of strings containing names of modules.

equ

public boolean equ(CoopnTypeAgg left,
                   CoopnTypeAgg right)
Description copied from interface: CoopnTypeRelation
Equivalence between two lists of types.
Specified by:
equ in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first list of types
right - the second list of types
Returns:
true iff both lists of types are equivalents with regard to the type relation represented by this object.

equ

public boolean equ(CoopnType left,
                   CoopnType right)
Description copied from interface: CoopnTypeRelation
Equivalence between two types.
Specified by:
equ in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first type
right - the second type
Returns:
true iff both types are equivalents with regard to the type relation represented by this object.

less

public boolean less(CoopnTypeAgg sub,
                    CoopnTypeAgg sup)
Description copied from interface: CoopnTypeRelation
Order between two lists of types.
Specified by:
less in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first list of types
sup - the second list of types
Returns:
true iff sub is less or equal to sup AND at least one element of sub is strictly less than the same element of sup.

less

public boolean less(CoopnType sub,
                    CoopnType sup)
Description copied from interface: CoopnTypeRelation
Order between two types.
Specified by:
less in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first type
sup - the second type
Returns:
true iff sub is a strict sub-sort or a sub-type of sup.

lessOrEqu

public boolean lessOrEqu(CoopnTypeAgg sub,
                         CoopnTypeAgg sup)
Description copied from interface: CoopnTypeRelation
Order between two lists of types.
Specified by:
lessOrEqu in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first list of types
sup - the second list of types
Returns:
true iff every element of sub is a sub-sort or a sub-type of the same (indexed) element sup.

lessOrEqu

public boolean lessOrEqu(CoopnType sub,
                         CoopnType sup)
Description copied from interface: CoopnTypeRelation
Order between two types.
Specified by:
lessOrEqu in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
sub - the first type
sup - the second type
Returns:
true iff sub is a sub-sort or a sub-type of sup.

unifiable

public boolean unifiable(CoopnTypeAgg left,
                         CoopnTypeAgg right)
Description copied from interface: CoopnTypeRelation
Compatibility for unification between two lists of types.
Specified by:
unifiable in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first list of types
right - the second list of types
Returns:
true iff both types of every (indexed) element are compatibles with regard to the type relation represented by this object.

unifiable

public boolean unifiable(CoopnType left,
                         CoopnType right)
Description copied from interface: CoopnTypeRelation
Compatibility for unification between two types.
Specified by:
unifiable in interface CoopnTypeRelation
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTypeRelation
Parameters:
left - the first type
right - the second type
Returns:
true iff both types are compatibles with regard to the type relation represented by this object.

unmodifiableCollection

protected SymbolCollection unmodifiableCollection()

cloneSymbolCollection

protected SymbolCollection cloneSymbolCollection()

unmodifiableCopy

public abstract java.lang.Object unmodifiableCopy()

clone

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