|
|||||||||
| Home >> All >> com >> thermidor >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.thermidor.xml
Class TokenTable

java.lang.Objectcom.thermidor.xml.TokenTable
- public class TokenTable
- extends java.lang.Object
The TokenTable class is a genric token table used to maintain an list of string identifiers to token mappings, and finds particular use in the implementation of parsers.
| Field Summary | |
private boolean |
checkIntegrity
Flag indication whether the TokenTable instance should check for the integrity of the proposed mappings. |
private static java.lang.String |
MSG_DUPLICATE_IDENTIFIER
Message constant Duplicate identifier [Identifier]
=. |
private static java.lang.String |
MSG_DUPLICATE_TOKEN
Message constant Duplicate token. |
private static java.lang.String |
MSG_TOKEN_REASSIGNMENT
Message constant Duplicate identifier and token added. |
private static java.lang.String |
MSG_UNDEFINED_TOKEN
Message constant A token cannot posses value
used to define an undefined mapping:. |
static int |
NO_TOKEN_DEFINED
Constant used to indicate that no mapping was defined for a given identifier. |
private boolean |
ready
Flag indicating whether the TokenTable instance has been declared ready. |
private java.util.HashMap |
tokenTable
Essentially the token table for storing the mapping between given identifiers and their tokens. |
| Constructor Summary | |
TokenTable()
Default constructor. |
|
TokenTable(boolean checkIntegrity)
Instantiates a token table with integrity checking. |
|
| Method Summary | |
private void |
assertIntegrity(java.lang.String identifier,
int token)
Performs a series of integrity checks on the proposed identifier and token: (a) that the identifier is not NULL (b) that the token is not the reserved value for designating an unknown mapping and (c) that there is no duplication of previously held mapping information. |
private void |
assertNoDuplicates(java.lang.String proposedIdentifier,
int proposedToken)
Asserts that there is no duplication of previously held mapping information. |
private static void |
assertNotNull(java.lang.String identifier)
Asserts that the proposed identifier is not Null. |
private static void |
assertNotUndefinedToken(int proposedToken)
Asserts that the proposed token is not the same as the constant used to designate an undefined mapping. |
private void |
assertReady(boolean isReady)
Asserts that the TokenTable is in the state specified in the isReady parameter. |
int |
getToken(java.lang.String identifier)
|
boolean |
isReady()
Utility method for discovering whether the token table has been declared ready. |
void |
put(java.lang.String identifier,
int token)
Stores the mapping between the identifier and the token. |
void |
ready()
Signals that the population of the token table has finished. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
NO_TOKEN_DEFINED
public static final int NO_TOKEN_DEFINED
- Constant used to indicate that no mapping was defined for a given
identifier.
- See Also:
- Constant Field Values
tokenTable
private java.util.HashMap tokenTable
- Essentially the token table for storing the mapping between given
identifiers and their tokens.
ready
private boolean ready
- Flag indicating whether the TokenTable instance has been declared ready.
Ready means that no more mappings will be added to the token table and
it is ready to be used by clients.
checkIntegrity
private final boolean checkIntegrity
- Flag indication whether the TokenTable instance should check for the
integrity of the proposed mappings.
MSG_UNDEFINED_TOKEN
private static final java.lang.String MSG_UNDEFINED_TOKEN
- Message constant
A token cannot posses value used to define an undefined mapping:.
MSG_TOKEN_REASSIGNMENT
private static final java.lang.String MSG_TOKEN_REASSIGNMENT
- Message constant
Duplicate identifier and token added. [Identifier,TOKEN]=.
MSG_DUPLICATE_TOKEN
private static final java.lang.String MSG_DUPLICATE_TOKEN
- Message constant
Duplicate token. [Existing,Token,Identifier] =.
MSG_DUPLICATE_IDENTIFIER
private static final java.lang.String MSG_DUPLICATE_IDENTIFIER
- Message constant
Duplicate identifier [Identifier] =.
| Constructor Detail |
TokenTable
public TokenTable()
- Default constructor. Instantiates a token table with integrity checking.
TokenTable
public TokenTable(boolean checkIntegrity)
- Instantiates a token table with integrity checking.
| Method Detail |
put
public final void put(java.lang.String identifier, int token)
- Stores the mapping between the identifier and the token.
assertIntegrity
private void assertIntegrity(java.lang.String identifier, int token)
- Performs a series of integrity checks on the proposed identifier
and token: (a) that the identifier is not NULL (b) that the token
is not the reserved value for designating an unknown mapping and
(c) that there is no duplication of previously held mapping information.
assertNotNull
private static void assertNotNull(java.lang.String identifier)
- Asserts that the proposed identifier is not Null.
assertNotUndefinedToken
private static void assertNotUndefinedToken(int proposedToken)
- Asserts that the proposed token is not the same as the constant used to
designate an undefined mapping.
assertReady
private void assertReady(boolean isReady)
- Asserts that the TokenTable is in the state specified in the isReady
parameter.
assertNoDuplicates
private void assertNoDuplicates(java.lang.String proposedIdentifier, int proposedToken)
- Asserts that there is no duplication of previously held mapping
information.
getToken
public final int getToken(java.lang.String identifier)
ready
public void ready()
- Signals that the population of the token table has finished. This
prevents further mappings from being added to the TokenTable.
isReady
public boolean isReady()
- Utility method for discovering whether the token table has been declared
ready.
|
|||||||||
| Home >> All >> com >> thermidor >> [ xml overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.thermidor.xml.TokenTable