kmy.jint.parser
Class Identifier
java.lang.Object
|
+--kmy.jint.parser.Identifier
- public class Identifier
- extends java.lang.Object
This class represents a simple (not qualified) identifier. All identifiers
are listed in the NameTable and have a unique integer id. Thus, it is more
efficient to compare and look up an Identifier then a String.
Field Summary |
int |
id
Unique integer id for this identifier. |
java.lang.String |
name
String representation of this identifier. |
NameTable |
nameTable
Pointer to a NameTable where this Identifier is registered. |
Constructor Summary |
(package private) |
Identifier(NameTable owner,
java.lang.String name,
int id)
Constructor; meant to be used only by NameTable. |
Method Summary |
boolean |
equals(java.lang.Object t)
Idenifier is equal only to itself. |
int |
hashCode()
Hashcode is just identifier's id. |
boolean |
isReserved()
Some identifiers represent reserved keywords in Java and this
method tests if this is one of these. |
java.lang.String |
toString()
Returns identifier's string representation (its 'name' member). |
Methods inherited from class java.lang.Object |
,
clone,
finalize,
getClass,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
nameTable
public NameTable nameTable
- Pointer to a NameTable where this Identifier is registered. Normally there
is only one NameTable around.
name
public java.lang.String name
- String representation of this identifier.
id
public int id
- Unique integer id for this identifier. All ids are negative.
Identifier
Identifier(NameTable owner,
java.lang.String name,
int id)
- Constructor; meant to be used only by NameTable. Use NameTable.lookupAndInsert(String)
if you want to get an Identifier. It will return the same identifier for all
equal strings.
hashCode
public int hashCode()
- Hashcode is just identifier's id.
- Overrides:
- hashCode in class java.lang.Object
equals
public boolean equals(java.lang.Object t)
- Idenifier is equal only to itself.
- Overrides:
- equals in class java.lang.Object
isReserved
public boolean isReserved()
- Some identifiers represent reserved keywords in Java and this
method tests if this is one of these.
toString
public java.lang.String toString()
- Returns identifier's string representation (its 'name' member).
- Overrides:
- toString in class java.lang.Object