alun.util
Class HashOfHash

java.lang.Object
  extended by alun.util.HashOfHash

public class HashOfHash
extends java.lang.Object

Creates a structure of two way hash tables, actually a hashtable of hashtables. This allows putting and getting of objects by a pair of keys. This structure is basically similar to an adjacency matrix representation of a graph. This implementation is not symetric, that is, the key pair (a,b) is not the same as the key pair (b,a).


Constructor Summary
HashOfHash()
          Create a new hashtable of hashtables.
 
Method Summary
 void clear()
          Empties the current structure.
 java.util.Hashtable get()
          Returns the hashtable in which the other hashtables are keyed.
 java.util.Hashtable get(java.lang.Object a)
          Returns the hashtable keyed by the object a.
 java.lang.Object get(java.lang.Object a, java.lang.Object b)
          Gets the object keyed by the given objects.
 boolean put(java.lang.Object a)
          If it doesn't already exist this puts a new hashtable keyed to by the object a.
 void put(java.lang.Object a, java.lang.Object b, java.lang.Object c)
          Puts the third object into a location keys by the first two.
 java.lang.Object remove(java.lang.Object a, java.lang.Object b)
          Removes any object keyed to by the given objects.
 java.lang.String toString()
          Returns a string representation of the data in the structure.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HashOfHash

public HashOfHash()
Create a new hashtable of hashtables.

Method Detail

clear

public final void clear()
Empties the current structure.


put

public final void put(java.lang.Object a,
                      java.lang.Object b,
                      java.lang.Object c)
Puts the third object into a location keys by the first two.


get

public final java.lang.Object get(java.lang.Object a,
                                  java.lang.Object b)
Gets the object keyed by the given objects. get(a,b) and get(b,a) return the same object. If there is no keyed element, it returns null.


remove

public final java.lang.Object remove(java.lang.Object a,
                                     java.lang.Object b)
Removes any object keyed to by the given objects. remove(a,b) and remove(b,a) have the same effect.


toString

public java.lang.String toString()
Returns a string representation of the data in the structure.

Overrides:
toString in class java.lang.Object

put

public final boolean put(java.lang.Object a)
If it doesn't already exist this puts a new hashtable keyed to by the object a. Returns true iff a new insertion was necessary.


get

public final java.util.Hashtable get(java.lang.Object a)
Returns the hashtable keyed by the object a. get(a,b) is equivalent to get(a).get(b) with some checking;


get

public final java.util.Hashtable get()
Returns the hashtable in which the other hashtables are keyed.