edu.vt.marian.search
Class WtdObjTable
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--edu.vt.marian.search.FullIDTable
|
+--edu.vt.marian.search.WtdObjTable
- Direct Known Subclasses:
- InsertionOrderWtdObjTable, SetImageWtdObjTable
- public class WtdObjTable
- extends FullIDTable
- implements java.util.Enumeration
Provides hash table functionality for (singly-linked) weighted
objects keyed on FullIDs. This class utilises the FullIDTable
class to provide the basic hash table functionality, but also
allows an implicit "threading" of the weighted objects in the hash
table. So, the hash table allows direct access to any part of the
logical ordering of the items in the table, but the "next"
"pointers" stored in each hashed object allow the next logical item
in the ordering to be retrieved.
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:
WtdObjSingleLink,
WtdObj,
Hashtable,
Debug, Serialized Form
|
Constructor Summary |
WtdObjTable(edu.vt.marian.common.Debug debug)
Create an empty hash table for (singly-linked) weighted objects |
WtdObjTable(int initialCapacity,
edu.vt.marian.common.Debug debug)
Create an empty hash table for (singly-linked) weighted objects
specifying initial capacity, but with default load factor. |
WtdObjTable(int initialCapacity,
float loadFactor,
edu.vt.marian.common.Debug debug)
Create an empty hash table for (singly-linked) weighted objects
specifying initial capacity and load factor. |
|
Method Summary |
java.util.Enumeration |
elements()
Return an Enumeration for the weighted objects in this table. |
java.util.Enumeration |
elements(edu.vt.marian.common.FullID entryPoint)
Return an Enumeration for the weighted objects in this table
starting at a specific point denoted by the given key. |
WtdObjSingleLink |
getNext(WtdObjSingleLink wtdObj)
Return the next weighted object in this ordered hash
table based upon the given weighted object from the table. |
boolean |
hasMoreElements()
Return true if this table enumeration has more elements, else return
false. |
java.lang.Object |
nextElement()
Return the next weighted object element in this table's enumeration. |
| Methods inherited from class java.util.Hashtable |
clear,
clone,
contains,
containsKey,
containsValue,
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 |
enum
protected WtdObjSingleLink enum
- nextElement item for use in Enumerations
WtdObjTable
public WtdObjTable(edu.vt.marian.common.Debug debug)
- Create an empty hash table for (singly-linked) weighted objects
WtdObjTable
public WtdObjTable(int initialCapacity,
float loadFactor,
edu.vt.marian.common.Debug debug)
- Create an empty hash table for (singly-linked) weighted objects
specifying initial capacity and load factor.
- Parameters:
initialCapacity - initial size of hash tableloadFactor - occupancy threshold before growth neededdebug - debugging object
WtdObjTable
public WtdObjTable(int initialCapacity,
edu.vt.marian.common.Debug debug)
- Create an empty hash table for (singly-linked) weighted objects
specifying initial capacity, but with default load factor.
- Parameters:
initialCapacity - initial size of hash tabledebug - debugging object
getNext
public WtdObjSingleLink getNext(WtdObjSingleLink wtdObj)
- Return the next weighted object in this ordered hash
table based upon the given weighted object from the table.
- Parameters:
wtdObj - (singly-linked) weighted object in table- Returns:
- key of the next item in the ordering
elements
public java.util.Enumeration elements(edu.vt.marian.common.FullID entryPoint)
- Return an Enumeration for the weighted objects in this table
starting at a specific point denoted by the given key. We
actually return this object, but set up to point to the given
place in the table, ready for nextElement() and
hasMoreElements().
- Parameters:
entryPoint - starting place in the table to begin the enumeration- Returns:
- Enumeration containing weighted object elements in table
- See Also:
nextElement(),
hasMoreElements()
elements
public java.util.Enumeration elements()
- Return an Enumeration for the weighted objects in this table.
We actually return this object, but set up to point to the
first element in the table, ready for nextElement() and
hasMoreElements().
- Returns:
- Enumeration containing weighted object elements in table
- Overrides:
- elements in class java.util.Hashtable
- See Also:
nextElement(),
hasMoreElements()
hasMoreElements
public boolean hasMoreElements()
- Return true if this table enumeration has more elements, else return
false.
- Specified by:
- hasMoreElements in interface java.util.Enumeration
- Returns:
- boolean denoting whether there are elements remaining in
this table's enumeration
- See Also:
Enumeration.hasMoreElements()
nextElement
public java.lang.Object nextElement()
throws java.util.NoSuchElementException
- Return the next weighted object element in this table's enumeration.
Also, set up the enum to be the next weighted object in the
threaded sequence.
- Specified by:
- nextElement in interface java.util.Enumeration
- Returns:
- Object that is the next in the sequence
- See Also:
Enumeration.nextElement()