org.locomotive.util
Class DoubleHashtable
java.lang.Object
|
+--org.locomotive.util.DoubleHashtable
- public class DoubleHashtable
- extends java.lang.Object
DoubleHashtable is a hashtable of hashtables,
where you use the first key to find a hashtable, and then
use the second key to search within that hashtable to find your item.
You can clear entire Hashtables at a time. Neat.
It even does periodic cleanup so that unused rows or columns will not
stick around and take up space as empty Hashtables.
Constructor Summary |
DoubleHashtable()
Default constructor sets up the DoubleHashtable with the
conserve memory property set to false. |
DoubleHashtable(boolean conserve_memory)
If you want to conserve memory usage, and you know that your
child Hashtables are temporary, then you should set
conserve_memory to true in order to make this class throw away
empty child Hashtables once in a while. |
Method Summary |
void |
clear()
|
boolean |
contains(java.lang.Object data_item)
traverses the ENTIRE Hashtable of Hashtables -- a very expensive
operation! Don't do this if you can possibly avoid it! |
boolean |
contains(java.lang.Object child_tables_key,
java.lang.Object items_key)
|
boolean |
containsChildTableKey(java.lang.Object child_tables_key)
|
java.lang.Object |
get(java.lang.Object child_tables_key,
java.lang.Object items_key)
|
java.util.Enumeration |
getAllChildTableKeys()
|
java.util.Enumeration |
getAllElements()
This is a VERY expensive operation -- it traverses the entire table. |
java.util.Hashtable |
getChildTable(java.lang.Object child_tables_key)
|
java.util.Enumeration |
getElementsOfChildTable(java.lang.Object child_tables_key)
|
java.util.Enumeration |
getKeysOfChildTable(java.lang.Object child_tables_key)
|
static void |
main(java.lang.String[] argv)
|
void |
put(java.lang.Object child_tables_key,
java.lang.Object items_key,
java.lang.Object data_item)
|
java.lang.Object |
remove(java.lang.Object child_tables_key,
java.lang.Object items_key)
|
java.util.Hashtable |
removeChildTable(java.lang.Object child_tables_key)
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
CLEANUP_INTERVAL
public static final int CLEANUP_INTERVAL
AVERAGE_ENTRIES_PER_ROW
public static final int AVERAGE_ENTRIES_PER_ROW
conserve_memory
public boolean conserve_memory
DoubleHashtable
public DoubleHashtable(boolean conserve_memory)
- If you want to conserve memory usage, and you know that your
child Hashtables are temporary, then you should set
conserve_memory to true in order to make this class throw away
empty child Hashtables once in a while.
DoubleHashtable
public DoubleHashtable()
- Default constructor sets up the DoubleHashtable with the
conserve memory property set to false.
put
public void put(java.lang.Object child_tables_key,
java.lang.Object items_key,
java.lang.Object data_item)
get
public java.lang.Object get(java.lang.Object child_tables_key,
java.lang.Object items_key)
getChildTable
public java.util.Hashtable getChildTable(java.lang.Object child_tables_key)
getAllChildTableKeys
public java.util.Enumeration getAllChildTableKeys()
getAllElements
public java.util.Enumeration getAllElements()
- This is a VERY expensive operation -- it traverses the entire table.
getKeysOfChildTable
public java.util.Enumeration getKeysOfChildTable(java.lang.Object child_tables_key)
getElementsOfChildTable
public java.util.Enumeration getElementsOfChildTable(java.lang.Object child_tables_key)
contains
public boolean contains(java.lang.Object data_item)
- traverses the ENTIRE Hashtable of Hashtables -- a very expensive
operation! Don't do this if you can possibly avoid it!
contains
public boolean contains(java.lang.Object child_tables_key,
java.lang.Object items_key)
containsChildTableKey
public boolean containsChildTableKey(java.lang.Object child_tables_key)
remove
public java.lang.Object remove(java.lang.Object child_tables_key,
java.lang.Object items_key)
removeChildTable
public java.util.Hashtable removeChildTable(java.lang.Object child_tables_key)
clear
public void clear()
main
public static void main(java.lang.String[] argv)