edu.vt.marian.search
Class FullIDTable

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--edu.vt.marian.search.FullIDTable
Direct Known Subclasses:
FullIDStringTable, WtdObjTable

public class FullIDTable
extends java.util.Hashtable

Provides hash table functionality for FullIDs. This class is really just a wrapper around the java.util.Hashtable class, with one of the ubiquitous Debug objects embedded in it.

This method implicitly relies upon the hashCode method to be defined in the object that is going to be used as a key object.

See Also:
FullID, FullID.hashCode(), Hashtable, Debug, Serialized Form

Field Summary
static int BAD_PARAMS
          Return value indicating bad parameters were supplied to method
protected  edu.vt.marian.common.Debug debug
          The ubiquitous debugging object
static int NULL_STREAM
          Return value to indicate passed stream object was null
static int OK
          Return value to indicate success
 
Constructor Summary
FullIDTable(edu.vt.marian.common.Debug debug)
          Create an empty hash table for FullIDs
FullIDTable(int initialCapacity, edu.vt.marian.common.Debug debug)
          Create an empty hash table for FullIDs specifying initial capacity, but with default load factor.
FullIDTable(int initialCapacity, float loadFactor, edu.vt.marian.common.Debug debug)
          Create an empty hash table for FullIDs specifying initial capacity and load factor.
 
Method Summary
 int toStream(java.io.PrintWriter pw)
          Dump the FullIDTable to an output stream (file).
 java.lang.String toString()
          Convert hash table to a printable string representation.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

protected edu.vt.marian.common.Debug debug
The ubiquitous debugging object

OK

public static final int OK
Return value to indicate success

BAD_PARAMS

public static final int BAD_PARAMS
Return value indicating bad parameters were supplied to method

NULL_STREAM

public static final int NULL_STREAM
Return value to indicate passed stream object was null
Constructor Detail

FullIDTable

public FullIDTable(edu.vt.marian.common.Debug debug)
Create an empty hash table for FullIDs

FullIDTable

public FullIDTable(int initialCapacity,
                   float loadFactor,
                   edu.vt.marian.common.Debug debug)
Create an empty hash table for FullIDs specifying initial capacity and load factor.
Parameters:
initialCapacity - initial size of hash table
loadFactor - occupancy threshold before growth needed
debug - debugging object

FullIDTable

public FullIDTable(int initialCapacity,
                   edu.vt.marian.common.Debug debug)
Create an empty hash table for FullIDs specifying initial capacity, but with default load factor.
Parameters:
initialCapacity - initial size of hash table
debug - debugging object
Method Detail

toString

public java.lang.String toString()
Convert hash table to a printable string representation.
Returns:
String containing object mappings
Overrides:
toString in class java.util.Hashtable
See Also:
FullID.toString()

toStream

public int toStream(java.io.PrintWriter pw)
Dump the FullIDTable to an output stream (file). This method invokes the toStream() method of FullID in writing both the key and hashed value to the output stream. The format of the dump is (key, object)*.
Parameters:
pw - output stream to which hash table should be dumped
Returns:
OK if table dumped successfully; NULL_STREAM if pw was null.