org.biomage.tools.xmlutils
Class MultiHashtable

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by org.biomage.tools.xmlutils.MultiHashtable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, MultiMap

public class MultiHashtable
extends java.util.Hashtable
implements MultiMap

Utility class for associating multiple values with a key in a Synchronized Map.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MultiHashtable()
          
MultiHashtable(int initial_capacity)
          
MultiHashtable(int initial_capacity, float load_factor)
          
MultiHashtable(java.util.Map copy_from)
          
MultiHashtable(MultiHashtable copy_from)
          Constructs a new MultiHashtable with the same mappings as the given MultiHashtable.
MultiHashtable(MultiMap copy_from)
          Constructs a new MultiHashtable with the same mappings as the given MultiMap.
 
Method Summary
 boolean containsValue(java.lang.Object value)
          
protected  java.util.Set createValuesSet()
          Factory method for instantiating objects of type Set for use as the containers of multiple values mapped to a single key.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           Note that this method will always return null.
 java.lang.Object remove(java.lang.Object key, java.lang.Object value)
          Remove the given ( key, value ) pair from this MultiMap.
 boolean removeAll(java.lang.Object obj)
          Remove all references to an Object (all values and a key, if any).
 java.util.Collection values()
          
 java.util.Collection valuesSets()
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, remove, size
 

Constructor Detail

MultiHashtable

public MultiHashtable()


MultiHashtable

public MultiHashtable(int initial_capacity)


MultiHashtable

public MultiHashtable(int initial_capacity,
                      float load_factor)


MultiHashtable

public MultiHashtable(MultiHashtable copy_from)
Constructs a new MultiHashtable with the same mappings as the given MultiHashtable.


MultiHashtable

public MultiHashtable(MultiMap copy_from)
Constructs a new MultiHashtable with the same mappings as the given MultiMap. Actually this just throws an UnsupportedOperationException, since we've no way to know how the given MultiMap is implemented.


MultiHashtable

public MultiHashtable(java.util.Map copy_from)

Method Detail

containsValue

public boolean containsValue(java.lang.Object value)

Specified by:
containsValue in interface java.util.Map
Overrides:
containsValue in class java.util.Hashtable

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Note that this method will always return null.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.Hashtable

removeAll

public boolean removeAll(java.lang.Object obj)
Remove all references to an Object (all values and a key, if any).

Specified by:
removeAll in interface MultiMap
Returns:
true iff anything was removed.

values

public java.util.Collection values()

Specified by:
values in interface java.util.Map
Overrides:
values in class java.util.Hashtable

remove

public java.lang.Object remove(java.lang.Object key,
                               java.lang.Object value)
Remove the given ( key, value ) pair from this MultiMap. If that was the only entry for the given key, the key will be removed altogether.

Specified by:
remove in interface MultiMap
Returns:
The given value, or null if the given ( key, value ) pair was not in the MultiMap.

valuesSets

public java.util.Collection valuesSets()
Specified by:
valuesSets in interface MultiMap
Returns:
The Collection of Sets, one for each present key. Any set returned may be null or empty. The Collection may also be null or empty.

createValuesSet

protected java.util.Set createValuesSet()
Factory method for instantiating objects of type Set for use as the containers of multiple values mapped to a single key. This should be a Synchronized Set.