dasher
Class CAlphabetMap

java.lang.Object
  extended by dasher.CAlphabetMap

public class CAlphabetMap
extends java.lang.Object

Simple map from the textual representation of alphabet symbols to their symbol numbers. This used to be a lot more complicated but now essentially just wraps a Java HashMap and could easily be removed and replaced by a HashMap member of Alphabet.


Field Summary
protected  java.util.HashMap<java.lang.String,SSymbol> hashTable
          The map itself, from Strings to SSymbols (a small class giving its integer index and a boolean value which determines whether it constitutes a prefix symbol.
private  int Undefined
          Constant used to represent any string which does not correspond to a valid symbol.
 
Constructor Summary
CAlphabetMap()
          Default constructor; creates the hash table with a size of 255.
CAlphabetMap(int InitialTableSize)
          Creates the Hash Table with a given initial size.
 
Method Summary
 void Add(java.lang.String Key, int Value)
          Adds a new key/value pair to the table.
 SSymbol Get(java.lang.String Key)
          Retrieves a symbol index given the string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashTable

protected java.util.HashMap<java.lang.String,SSymbol> hashTable
The map itself, from Strings to SSymbols (a small class giving its integer index and a boolean value which determines whether it constitutes a prefix symbol. This is always set to false by the constructor, so the class too is redundant and should be replaced by a simple Integer.

See Also:
SSymbol

Undefined

private final int Undefined
Constant used to represent any string which does not correspond to a valid symbol.

See Also:
Constant Field Values
Constructor Detail

CAlphabetMap

public CAlphabetMap(int InitialTableSize)
Creates the Hash Table with a given initial size.

Parameters:
InitialTableSize - Initial size

CAlphabetMap

public CAlphabetMap()
Default constructor; creates the hash table with a size of 255.

Method Detail

Add

public void Add(java.lang.String Key,
                int Value)
Adds a new key/value pair to the table.

Parameters:
Key - String representation of a symbol
Value - Integer index of same symbol

Get

public SSymbol Get(java.lang.String Key)
Retrieves a symbol index given the string representation.

Parameters:
Key - String to look up
Returns:
SSymbol containing the integer index of the symbol, or Undefined if the supplied String did not correspond to any symbol.