ConForM.CoopnTools.CoKer.CoalaMgr
Class CoalaSymbol

java.lang.Object
  |
  +--ConForM.CoopnTools.CoKer.CoalaMgr.CoalaElement
        |
        +--ConForM.CoopnTools.CoKer.CoalaMgr.CoalaSymbol
All Implemented Interfaces:
java.lang.Cloneable, CoopnSyntacticElement, CoopnSyntacticSymbol, java.io.Serializable
Direct Known Subclasses:
CoalaExceptionSymbol, CoalaHandlerSymbol, CoalaObjectSymbol, CoalaResolutionSymbol, CoalaRoleSymbol, CoalaUseCaaSymbol, CoalaUseSymbol, CoalaVariableSymbol

public abstract class CoalaSymbol
extends CoalaElement
implements CoopnSyntacticSymbol

Coala symbols. This abstract class essentially defines basic symbols in the coala asbtract syntax. This class must de extended in immutable classes, by defining "kind", "equals", "equivalents", "toString", "toText", "toDigest" and "clone" methods. In addition, for each textual attribute attr_i of type Attr_i, a private attribute variable must be defined, a constructor with parameters "(Attr_1 attr_1, ... , Attr_n attr_n)" must be defined, and n methods "Attr_i attr_i()" returning the value of the attribute must be defined.

See Also:
Serialized Form

Constructor Summary
protected CoalaSymbol(CoalaName name, CoalaModuleName module)
          Simple constructor.
protected CoalaSymbol(CoalaName name, CoalaModuleName module, java.lang.String comment)
          Simple constructor.
protected CoalaSymbol(CoalaName name, java.lang.String identifier, CoalaModuleName module)
          Simple constructor.
protected CoalaSymbol(CoalaName name, java.lang.String identifier, CoalaModuleName module, java.lang.String comment)
          Simple constructor.
 
Method Summary
protected  CoalaElement cloneCoalaElement()
          Internal cloning method.
 java.lang.String comment()
          Return the comment.
protected  boolean equalsCoalaSymbol(CoalaSymbol s)
          Internal equality testing method.
abstract  boolean equivalent(java.lang.Object s)
          Equivalence testing method.
protected  boolean equivalentCoalaSymbol(CoalaSymbol s)
          Internal equivalence testing method.
 int hashCode()
          Hashcode method.
 java.lang.String identifier()
          Return the identifier.
abstract  java.lang.String kind()
          Kind retrieving method.
 CoalaModuleName module()
          Return the module.
 CoalaName 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.CoalaMgr.CoalaTextMgr.CoalaTextName toTextCoalaSymbol()
          Internal Text conversion method.
 
Methods inherited from class ConForM.CoopnTools.CoKer.CoalaMgr.CoalaElement
clone, equals, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteString, toCompleteText, toCompleteText, toString, toString, toString, toText
 
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

CoalaSymbol

protected CoalaSymbol(CoalaName name,
                      java.lang.String identifier,
                      CoalaModuleName 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.

CoalaSymbol

protected CoalaSymbol(CoalaName name,
                      CoalaModuleName 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.

CoalaSymbol

protected CoalaSymbol(CoalaName name,
                      java.lang.String identifier,
                      CoalaModuleName 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.

CoalaSymbol

protected CoalaSymbol(CoalaName name,
                      CoalaModuleName 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

name

public CoalaName 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 CoalaModuleName 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 comment.
Specified by:
comment in interface CoopnSyntacticSymbol
Returns:
the comment

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.

equalsCoalaSymbol

protected boolean equalsCoalaSymbol(CoalaSymbol 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 CoalaElement
Following copied from interface: ConForM.CoopnTools.CoKer.CoopnSyntacticElement
Returns:
the hash code.

equivalentCoalaSymbol

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

toTextCoalaSymbol

protected ConForM.CoopnTools.CoKer.CoalaMgr.CoalaTextMgr.CoalaTextName toTextCoalaSymbol()
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.

cloneCoalaElement

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