MetaDone
metadone.util.MultHashMap< K, V > Class Reference
Collaboration diagram for metadone.util.MultHashMap< K, V >:

List of all members.

Public Member Functions

boolean containsKey (Object key)
boolean contains (Object key, Object value)
Set< V > get (final Object key)
boolean put (K key, V val)
void putAll (K key, Collection<?extends V > values)
void putAll (Map<?extends K,?extends V > m)
void putAll (MultHashMap<?extends K,?extends V > m)
boolean remove (Object key, Object val)
boolean remove (Object key)
void clear ()
Set< K > keySet ()
Iterator< Map.Entry< K, V > > iterator ()
String toString ()

Private Attributes

final Map< K, Set< V > > store = new HashMap<K, Set<V>>()

Detailed Description

Implements a one-to-many store.

The implementation uses a hash map which values are sets. The sets are internally implemented by LinkedHashSet to keep track of the order in which values were added for a given key.

Author:
Vincent
kma

Member Function Documentation

void metadone.util.MultHashMap< K, V >.clear ( )

Clears the elements.

boolean metadone.util.MultHashMap< K, V >.contains ( Object  key,
Object  value 
)

Tests if a pair is contained in this map.

Parameters:
keyThe key
valueThe value
Returns:
true if a pair (key,value) is present in this map
boolean metadone.util.MultHashMap< K, V >.containsKey ( Object  key)

Tests if a key has mappings in this multimap.

Parameters:
keyThe key to test
Returns:
true if the key is defined in the store
Set<V> metadone.util.MultHashMap< K, V >.get ( final Object  key)

Returns the set of elements linked to a key.

The resulting set is never null, elements can be removed but no element can be added.

Parameters:
keyThe key
Returns:
A set of values
Iterator<Map.Entry<K, V> > metadone.util.MultHashMap< K, V >.iterator ( )
Set<K> metadone.util.MultHashMap< K, V >.keySet ( )

Gets the key set.

Returns:
The key set
boolean metadone.util.MultHashMap< K, V >.put ( key,
val 
)

Adds a pair (key, val).

Parameters:
keyThe key
valThe value
Returns:
true if the pair was added
void metadone.util.MultHashMap< K, V >.putAll ( MultHashMap<?extends K,?extends V >  m)

Puts all the entries in this map.

Parameters:
mThe other map
void metadone.util.MultHashMap< K, V >.putAll ( Map<?extends K,?extends V >  m)

Puts all the entries in this map.

Parameters:
mThe other map
void metadone.util.MultHashMap< K, V >.putAll ( key,
Collection<?extends V >  values 
)

Puts all the pairs (key, value) in the map.

Parameters:
keyThe key
valuesThe values
boolean metadone.util.MultHashMap< K, V >.remove ( Object  key)

Removes all the pairs (key,*).

Postcondition:
this.contains(key)==false
Parameters:
keyThe key
Returns:
true if values were removed
boolean metadone.util.MultHashMap< K, V >.remove ( Object  key,
Object  val 
)

Removes a pair (key,val) from the store.

Parameters:
keyThe key
valThe value
Returns:
true if the pair was removed
String metadone.util.MultHashMap< K, V >.toString ( )

Member Data Documentation

final Map<K, Set<V> > metadone.util.MultHashMap< K, V >.store = new HashMap<K, Set<V>>() [private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations