com.fatdog.xmlEngine.words.dictionaries
Class WordListHashtable

java.lang.Object
  extended bycom.fatdog.xmlEngine.words.dictionaries.WordListHashtable

public class WordListHashtable
extends java.lang.Object

There be words here.

This class is derived originally from Hashtable. At present it's not a one-to-one replacement for it, but it's close.

12dec03: I've mutated IntList slightly by adding an IntList m_nextList field. This allows several ...XRef()-named methods here to use a linked- list structure to hold blocks of words having identical hashes and unique id's, with each word block holding the sequence of docId's the word occurs in.

NOTA: The way rehashing seems to work (looking at Sun code) is if m_count exceeds the threshold, where m_count is the total number of unique entries, not the number of buckets. Do we really want to rehash when this count is exceeded ????

Version:
0.66
Author:
Howard Katz, howardk@fatdog.com

Constructor Summary
WordListHashtable()
           
WordListHashtable(int initialCapacity)
           
WordListHashtable(int initialCapacity, float loadFactor)
           
 
Method Summary
 boolean containsKey(java.lang.String word)
           
 boolean containsKey(java.lang.String word, int[] hashId)
           
 boolean containsWordXRefs(java.lang.String word, int[] wordArgs)
          We check whether the word's already been entered in the dictionary.
 void debugSummary()
           
 int getKey(java.lang.String word)
           
 boolean isEmpty()
           
 void put(java.lang.String word, int[] hashId)
           
 void putWordXRef(java.lang.String word, int[] wordArgs)
           
 void putXRef(int[] wordArgs)
          We know the word's already in the dictionary -- we need to find its linked list entry (looking thru the list for a matching id) and add the currDocId to the end of the entry
 int size()
           
 java.lang.String wordFromKey(int key)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WordListHashtable

public WordListHashtable(int initialCapacity,
                         float loadFactor)

WordListHashtable

public WordListHashtable(int initialCapacity)

WordListHashtable

public WordListHashtable()
Method Detail

put

public void put(java.lang.String word,
                int[] hashId)

wordFromKey

public java.lang.String wordFromKey(int key)

getKey

public int getKey(java.lang.String word)

containsKey

public boolean containsKey(java.lang.String word)

putWordXRef

public void putWordXRef(java.lang.String word,
                        int[] wordArgs)

putXRef

public void putXRef(int[] wordArgs)
We know the word's already in the dictionary -- we need to find its linked list entry (looking thru the list for a matching id) and add the currDocId to the end of the entry

Parameters:
wordArgs - [ key ][ hash ][ index ] [ currDocId ]

containsWordXRefs

public boolean containsWordXRefs(java.lang.String word,
                                 int[] wordArgs)
We check whether the word's already been entered in the dictionary. whether it has been or not we return its computed hash and table index, to save a subsequent call to this object from having to recompute them.

We also return its key if it exists, else -1. We also return its lastDocId entry, since we want to make sure the current doc has one and only one entry in the slot for this word 0 1 2 3 wordArgs entries are: [ key ][ hash ][ index ][ lastDoc ]

Parameters:
word - the word being checked for existence in the dictionary
wordArgs - a 4-int array with contents as above
Returns:
boolean -- true if the word already exists

containsKey

public boolean containsKey(java.lang.String word,
                           int[] hashId)

size

public int size()

isEmpty

public boolean isEmpty()

debugSummary

public void debugSummary()