ConForM.CoopnTools.CoKer.CoopnMgr
Class CoopnSymbol

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoopnMgr.CoopnElement
        |
        +--ConForM.CoopnTools.CoKer.CoopnMgr.CoopnSymbol
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, CoopnSyntacticElement, CoopnSyntacticSymbol, java.io.Serializable
Direct Known Subclasses:
CoopnAdtFormulaSymbol, CoopnClassFormulaSymbol, CoopnClassPortSymbol, CoopnContextFormulaSymbol, CoopnContextPortSymbol, CoopnFunctionSymbol, CoopnInitialSymbol, CoopnMappingSymbol, CoopnObjectSymbol, CoopnPlaceSymbol, CoopnReferenceSymbol, CoopnSortSymbol, CoopnSubsortSymbol, CoopnSubtypeSymbol, CoopnTermVariable, CoopnTransitionSymbol, CoopnTypeSymbol, CoopnUseContextSymbol, CoopnUseSymbol, CoopnVariableSymbol

public abstract class CoopnSymbol
extends CoopnElement
implements CoopnSyntacticSymbol, java.lang.Comparable

Coopn symbols.

See Also:
Serialized Form

Constructor Summary
protected CoopnSymbol(CoopnName name, CoopnModuleName module)
          Simple constructor.
protected CoopnSymbol(CoopnName name, CoopnModuleName module, java.lang.String comment)
          Simple constructor.
protected CoopnSymbol(CoopnName name, java.lang.String identifier, CoopnModuleName module)
          Simple constructor.
protected CoopnSymbol(CoopnName name, java.lang.String identifier, CoopnModuleName module, java.lang.String comment)
          Simple constructor.
 
Method Summary
 int arity()
          Symbol arity.
protected  CoopnElement cloneCoopnElement()
          Internal cloning method.
 java.lang.String comment()
          Return the associated comment.
 int compareTo(java.lang.Object o)
           
 java.lang.String[] decompose()
          Symbol decomposition.
protected  boolean equalsCoopnSymbol(CoopnSymbol s)
          Internal equality testing method.
abstract  boolean equivalent(java.lang.Object s)
          Equivalence testing method.
protected  boolean equivalentCoopnSymbol(CoopnSymbol s)
          Internal equivalence testing method.
 int hashCode()
          Hashcode method.
 java.lang.String identifier()
          Return the identifier.
protected  int indexCoopnSymbol(CoopnSymbolTable table)
          Symbol number.
 CoopnElement interpret(CoopnSubstitution sigma)
          Interpretation of this element according to a substitution.
abstract  java.lang.String kind()
          Kind retrieving method.
 CoopnModuleName module()
          Return the module.
 CoopnName name()
          Return the name.
 java.lang.String symbolModule()
          Return the module name as a string.
 int symbolModuleKind()
          Get the module kind (in the sense of the package manager) of the module defining the symbol, for instance COOPNSOURCE, COALASOURCE, PACKAGE, and so on).
 java.lang.String symbolName()
          Return the name as a string.
protected  ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTextMgr.CoopnTextName toTextCoopnSymbol()
          Internal Text conversion method.
protected  CoopnSymbol unmodifiableSymbol()
           
protected  boolean usedCoopnSymbol(CoopnSymbolTable table)
          Is this symbol used.
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoopnMgr.CoopnElement
clone, equals, pureCOIL, pureCOOPN, toCoco, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteText, toCompleteText, toCompleteTokens, toCompleteTokens, toCompleteTokens, toCompleteTokens, toCompleteTokens, toCompleteTokens, toString, toString, toString, toText, toTokens, toTokens, toTokens, unmodifiableCopy
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ConForM.CoopnTools.CoKer.CoopnSyntacticElement
clone, equals, toCompleteString, toCompleteString, toCompleteString, toString, toString, toString
 

Constructor Detail

CoopnSymbol

protected CoopnSymbol(CoopnName name,
                      java.lang.String identifier,
                      CoopnModuleName module)
               throws java.lang.IllegalArgumentException
Simple constructor.
Parameters:
name - the name. May be null if symbol has no name.
identifier - the identifier. The identifier is merely used for the convenience of users, allowing them to identify symbols even when they have no names. Identifiers are not taking part in symbol comparisons, for equality and for equivalence.
module - the definition module. Cannot be null.
Throws:
java.lang.IllegalArgumentException - identifier or module are null references.

CoopnSymbol

protected CoopnSymbol(CoopnName name,
                      CoopnModuleName module)
               throws java.lang.IllegalArgumentException
Simple constructor.
Parameters:
name - the name and the identifier of the symbol. Cannot be null.
module - the definition module. Cannot be null.
Throws:
java.lang.IllegalArgumentException - name or module are null references.

CoopnSymbol

protected CoopnSymbol(CoopnName name,
                      java.lang.String identifier,
                      CoopnModuleName module,
                      java.lang.String comment)
               throws java.lang.IllegalArgumentException
Simple constructor.
Parameters:
name - the name. May be null if symbol has no name.
identifier - the identifier. The identifier is merely used for the convenience of users, allowing them to identify symbols even when they have no names. Identifiers are not taking part in symbol comparisons, for equality and for equivalence.
module - the definition module. Cannot be null.
Throws:
java.lang.IllegalArgumentException - identifier or module are null references.

CoopnSymbol

protected CoopnSymbol(CoopnName name,
                      CoopnModuleName module,
                      java.lang.String comment)
               throws java.lang.IllegalArgumentException
Simple constructor.
Parameters:
name - the name and the identifier of the symbol. Cannot be null.
module - the definition module. Cannot be null.
Throws:
java.lang.IllegalArgumentException - name or module are null references.
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

name

public CoopnName name()
Return the name.
Returns:
the name

symbolName

public java.lang.String symbolName()
Return the name as a string.
Specified by:
symbolName in interface CoopnSyntacticSymbol
Returns:
the name

identifier

public java.lang.String identifier()
Return the identifier.
Specified by:
identifier in interface CoopnSyntacticSymbol
Returns:
the identifier

module

public CoopnModuleName module()
Return the module.
Returns:
the module name

symbolModule

public java.lang.String symbolModule()
Return the module name as a string.
Specified by:
symbolModule in interface CoopnSyntacticSymbol
Returns:
the module name

symbolModuleKind

public int symbolModuleKind()
Get the module kind (in the sense of the package manager) of the module defining the symbol, for instance COOPNSOURCE, COALASOURCE, PACKAGE, and so on).
Specified by:
symbolModuleKind in interface CoopnSyntacticSymbol
Returns:
the module kind.

comment

public java.lang.String comment()
Return the associated comment.
Specified by:
comment in interface CoopnSyntacticSymbol
Returns:
the associated comment or null.

arity

public int arity()
Symbol arity.
Returns:
the arity, i.e. the number of "underline" in the name

decompose

public java.lang.String[] decompose()
Symbol decomposition. A symbol name is composed of words and of underline characters representing parameter locations. This methods decompose the symbol names in its constituents.
Returns:
an array of string, the elements of which are either a word, or a null reference indicating the position of a parameter.

interpret

public CoopnElement interpret(CoopnSubstitution sigma)
Interpretation of this element according to a substitution. Actually returns a clone of the element itself. This strategy is valid for all symbols, except for meta-element symbols.
Overrides:
interpret in class CoopnElement
Parameters:
sigma - the substitution; cannot be null
Returns:
a clone of the element, as the interpretation of a symbol is usually the same symbol.

kind

public abstract java.lang.String kind()
Kind retrieving method. This method must be defined in the inherited classes for returning a string allowing the user to know what kind of symbol this is.
Specified by:
kind in interface CoopnSyntacticSymbol
Returns:
a string defining the symbol kind.

equivalent

public abstract boolean equivalent(java.lang.Object s)
Equivalence testing method. This method must be defined in the inherited classes for returning a boolean deciding if this symbol is equivalent to the parameter. Two symbols are equivalents if they are equals, or if they are equals when source modules are not considered. For instance, transition "T" in "Module1" and transition "T" in "Module2" are are not equal, but are equivalent.
Returns:
true iff both symbols are equivalents.

equalsCoopnSymbol

protected boolean equalsCoopnSymbol(CoopnSymbol s)
Internal equality testing method. Should be used by the inherited classes for implementing their own "equals" method.
Returns:
true iff names and modules are equals.

hashCode

public int hashCode()
Description copied from interface: CoopnSyntacticElement
Hashcode method. Must be defined in the inherited classes.
Specified by:
hashCode in interface CoopnSyntacticElement
Overrides:
hashCode in class CoopnElement
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnSyntacticElement
Returns:
the hash code.

equivalentCoopnSymbol

protected boolean equivalentCoopnSymbol(CoopnSymbol s)
Internal equivalence testing method. Should be used by the inherited classes for implementing their own "equivalent" method.
Returns:
true iff names are equals.

toTextCoopnSymbol

protected ConForM.CoopnTools.CoKer.CoopnMgr.CoopnTextMgr.CoopnTextName toTextCoopnSymbol()
Internal Text conversion method. Should be used by the inherited classes for implementing their own "toText" and "toCompleteText" methods.
Returns:
The CoopnTextName associated to this symbol, or null if the symbol has no name.

indexCoopnSymbol

protected int indexCoopnSymbol(CoopnSymbolTable table)
                        throws java.lang.IllegalArgumentException
Symbol number. Should be used by the inherited classes for implementing their own "toCoco" method.
Returns:
the symbol number in the table

usedCoopnSymbol

protected boolean usedCoopnSymbol(CoopnSymbolTable table)
                           throws java.lang.IllegalArgumentException
Is this symbol used. Should be used by the inherited classes for implementing their own "toCoco" method.
Returns:
true iff this symbol is used

unmodifiableSymbol

protected CoopnSymbol unmodifiableSymbol()

cloneCoopnElement

protected CoopnElement cloneCoopnElement()
Internal cloning method. Should be used by the inherited classed for implementing their own "clone" method.
Overrides:
cloneCoopnElement in class CoopnElement
Returns:
a clone element.