public interface SymbolTable
| Modifier and Type | Field and Description |
|---|---|
static int |
UNKNOWN_SYMBOL_ID
The value returned for a symbol that is not in
the symbol table, namely
-1. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Removes all the symbols from the symbol table.
|
int |
getOrAddSymbol(String symbol)
Returns the identifier for the specified symbol.
|
String |
idToSymbol(int id)
Return the symbol corresponding to the specified identifier.
|
int |
numSymbols()
Returns the number of symbols in this symbol table.
|
int |
removeSymbol(String symbol)
Removes the specified symbol from the symbol table if
it was in the table and returns its identifier.
|
int |
symbolToID(String symbol)
Return the identifier corresponding to the specified symbol,
-1 if the symbol does not exist. |
static final int UNKNOWN_SYMBOL_ID
-1.int symbolToID(String symbol)
-1 if the symbol does not exist. The constant
-1 is available as the value of UNKNOWN_SYMBOL_ID.symbol - Symbol whose identifier is returned.-1 if the symbol does not exist.String idToSymbol(int id)
0 and the
number of symbols in the table minus one, inclusive. Raises an
index out of bounds exception for identifiers out of range.id - Identifier whose symbol is returned.IndexOutOfBoundsException - If there is no symbol for the
specified identifier.int numSymbols()
int getOrAddSymbol(String symbol)
symbol - Symbol whose identifier is returned.UnsupportedOperationException - If this operation is not
supproted.int removeSymbol(String symbol)
-1, or
UNKNOWN_SYMBOL_ID is returned. Optional operation.symbol - Symbol to remove.-1 if it didn't exist.UnsupportedOperationException - If this operation is
not supported by this implementation.void clear()
If an implementing class does not allow removal, it may throw an unsupported operation exception for this method. OPtional operationl.
UnsupportedOperationException - If this operation is
not supported by this implementation.Copyright © 2019 Alias-i, Inc.. All rights reserved.