|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--torero.model.Symbol
The Symbol Object is the base class for Token, Nonterm and Epsilon in Toreros Attribute Grammar Model. This Class encapsulates the general properties of symbols used in grammars. Symbols have a unique name and the capability to have Attributes (in terms of Attribute Grammars) assigned to it. Symbol Instances should be obtained via the SymbolMap that can guarantee their uniqueness. Additionally it redefines the equals and compareTo Operator for maintainig a well defined sort order and the uniqueness in java collection classes.
AttributeGrammar
,
SymbolMap
, Serialized FormConstructor Summary | |
protected |
Symbol(String Name,
SymbolMap k)
This constuctor should not be called directly. |
Method Summary | |
boolean |
addAttribute(Attribute anAttribute)
This method is used to add Attributes to this Symbol. |
void |
changeName(String name)
This is a save method to change a Symbol name. |
int |
compareTo(Object o)
Reimplemtented for a well defined sort order of Symbol objects. |
boolean |
equals(Object o)
Reimplemtented for a uniqueness based on the symbols field name. |
int |
getAttributePos(Attribute atr)
This method returns the position of the given Attribute in the symbols set of attributes. |
Object[] |
getAttributes()
This method returns the Attributes of the Symbol as Array. |
int |
getAttributesSize()
This method returns the Number of Attributes the Symbol has. |
String |
getName()
Returns the Name of the Symbol and takes care of escaped characters. |
String |
getStringRep()
Returns a String Representation of this Symbol including its attributes. |
boolean |
hasAttribute(Attribute attrib)
This method is used to check if the Symbol contains the given Attribute. |
boolean |
isEpsilon()
Is it the Epsilon Symbol ? |
boolean |
isLeaf()
Is this Symbol a leaf ? |
boolean |
isLiteral()
Is it a Literal Symbol ? |
void |
removeAttribute(Attribute anAttribute)
This method is used to remove Attributes to this Symbol. |
String |
toDot()
Returns the Dot Graph Representation of this Symbol. |
StringBuffer |
toOx(StringBuffer sb)
It writes the Ox Representation of this Symbol on the given StringBuffer. |
StringBuffer |
toOxDecl(StringBuffer sb)
It writes the Ox Declaration Section Representation of this Symbol on the given StringBuffer. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Symbol(String Name, SymbolMap k)
Method Detail |
public String getName()
public String getStringRep()
public StringBuffer toOx(StringBuffer sb)
sb
- the StringBuffer to write ontopublic StringBuffer toOxDecl(StringBuffer sb)
sb
- the StringBuffer to write ontopublic String toDot()
public void changeName(String name) throws SymbolNameException
name
- the new name for this Symbolpublic boolean addAttribute(Attribute anAttribute)
public boolean hasAttribute(Attribute attrib)
public void removeAttribute(Attribute anAttribute)
public Object[] getAttributes()
public int getAttributesSize()
public int getAttributePos(Attribute atr)
public boolean isLeaf()
public boolean isLiteral()
public boolean isEpsilon()
public int compareTo(Object o)
compareTo
in interface Comparable
public boolean equals(Object o)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |