|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--edu.vt.marian.search.FullIDTable
|
+--edu.vt.marian.search.WtdObjTable
|
+--edu.vt.marian.search.SetImageWtdObjTable
Provides hash table functionality for (doubly-linked) weighted objects keyed on FullIDs, and "threaded" into multiple linked lists. Specifically, the Table is to be used to maintain "images" of a collection of weighted object sets. Since each set is inserted into the table in non-increasing weight order, the images are also in that order. Objects may be removed from each image, rejoining the list around the removed element, the order being maintained.
When this Table is used in a Searcher, each set image is composed of only those objects that occur in only one component set. Objects that occur in more than one set are excised from the set image and added to another list of "multiply hit" elements. Note that the weighted object in question does not leave the table, and does not move within the hash order. The only change to the object (other than accumulating weight) is that its links to next and previous elements are switched from elements in a set image to elements in the multiHit list.
This class is essentially a wrapper around WtdObjTable to impose the set image semantics.
This structure implicitly relies upon the hashCode method to be defined in the object that is going to be used as a key object.
NOTE: Since this Table maintains many separate Enumerations (one for each set image pkus one for multiHit) it cannot be itself an Enumeration.
WtdObjTable,
WtdObjSingleLink,
WtdObj,
Hashtable,
Debug, Serialized Form| Fields inherited from class edu.vt.marian.search.WtdObjTable |
enum |
| Fields inherited from class edu.vt.marian.search.FullIDTable |
BAD_PARAMS,
debug,
NULL_STREAM,
OK |
| Constructor Summary | |
SetImageWtdObjTable(edu.vt.marian.common.Debug debug)
Create an empty hash table for (singly-linked) weighted objects |
|
SetImageWtdObjTable(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. |
|
SetImageWtdObjTable(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 | |
void |
clear()
Clear hash table. |
WtdObjSetEnumeration |
imageElements(int image)
Return a WtdObjSetEnumeration for the weighted objects in some set image. |
java.lang.Object |
insert(edu.vt.marian.common.WtdObj wtdObj)
Add a weighted object to the table in the set image last selected. |
java.util.Enumeration |
multiHitElements()
Return an Enumeration for the weighted objects in the multiHit list. |
int |
newImage()
Add a new set image. |
int |
setImage(int image)
Change to a previously defined set image. |
| Methods inherited from class edu.vt.marian.search.WtdObjTable |
elements,
elements,
getNext,
hasMoreElements,
nextElement |
| Methods inherited from class edu.vt.marian.search.FullIDTable |
toStream,
toString |
| Methods inherited from class java.util.Hashtable |
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 |
| Constructor Detail |
public SetImageWtdObjTable(edu.vt.marian.common.Debug debug)
public SetImageWtdObjTable(int initialCapacity,
float loadFactor,
edu.vt.marian.common.Debug debug)
initialCapacity - initial size of hash tableloadFactor - occupancy threshold before growth neededdebug - debugging object
public SetImageWtdObjTable(int initialCapacity,
edu.vt.marian.common.Debug debug)
initialCapacity - initial size of hash tabledebug - debugging object| Method Detail |
public int newImage()
public int setImage(int image)
image - An image ID previously returned by newImage().public java.lang.Object insert(edu.vt.marian.common.WtdObj wtdObj)
OK, PAUL, DESIGN QESTION TIME: Is it better for the Table to maintain multiHit and do both the weight computations and the moving between lists as part of insert(), or should the searcher be responsible for testing isInTable(), snipping the object out of the set image, adding in the new wieght and attaching it to multiHit? My best thinking at the moment is that the Table should maintain multiHit and do the moving, that the WtdObjDoubleLink should handle Weight accumulation, and that the Searcher does nothing but call insert() as many times as it needs. But I'm not completely convinced yet.
wtdObj - weighted object to be insertedpublic WtdObjSetEnumeration imageElements(int image)
image - An image ID previously returned by newImage().WtdObjSetEnumerationpublic java.util.Enumeration multiHitElements()
NOTE: Unlike the set images, multiHit is not in Weight order, so the ordering of elements in the Enumeration returned is arbitrary.
WtdObjTable.nextElement(),
WtdObjTable.hasMoreElements()public void clear()
Hashtable
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||