edu.stanford.nlp.util
Class DeltaCollectionValuedMap<K,V>

java.lang.Object
  extended by edu.stanford.nlp.util.CollectionValuedMap<K,V>
      extended by edu.stanford.nlp.util.DeltaCollectionValuedMap<K,V>
All Implemented Interfaces:
Serializable, Map<K,Collection<V>>

public class DeltaCollectionValuedMap<K,V>
extends CollectionValuedMap<K,V>

Implementation of CollectionValuedMap that appears to store an "original" map and changes to that map. No one currently uses it. See DeltaMap.

Author:
Teg Grenager (grenager@cs.stanford.edu) Date: Jan 14, 2004 Time: 10:40:57 AM
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class edu.stanford.nlp.util.CollectionValuedMap
cf, mf
 
Constructor Summary
DeltaCollectionValuedMap(CollectionValuedMap<K,V> originalMap)
           
 
Method Summary
 void add(K key, V value)
          Adds the value to the Collection mapped to by the key.
 void addAll(Map<K,V> m)
          Adds all of the mappings in m to this CollectionValuedMap.
 void clear()
          This is more expensive than normal.
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
          Unsupported.
 Set<Map.Entry<K,Collection<V>>> entrySet()
          This is cheap.
 Collection<V> get(Object key)
           
 boolean isEmpty()
           
 Collection<V> put(K key, Collection<V> value)
          Replaces current Collection mapped to key with the specified Collection.
 void putAll(Map<? extends K,? extends Collection<V>> m)
          Unsupported.
 Collection<V> remove(Object key)
          Removes the mapping associated with this key from this Map.
 void removeMapping(K key, V value)
          Removes the value from the Collection mapped to by this key, leaving the rest of the collection intact.
 int size()
          The number of keys in this map.
 Collection<Collection<V>> values()
           
 
Methods inherited from class edu.stanford.nlp.util.CollectionValuedMap
addAll, allValues, clone, deltaClone, equals, hashCode, keySet, main, removeAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeltaCollectionValuedMap

public DeltaCollectionValuedMap(CollectionValuedMap<K,V> originalMap)
Method Detail

get

public Collection<V> get(Object key)
Specified by:
get in interface Map<K,Collection<V>>
Overrides:
get in class CollectionValuedMap<K,V>
Returns:
the Collection mapped to by key, never null, but may be empty.

put

public Collection<V> put(K key,
                         Collection<V> value)
Description copied from class: CollectionValuedMap
Replaces current Collection mapped to key with the specified Collection. Use carefully!

Specified by:
put in interface Map<K,Collection<V>>
Overrides:
put in class CollectionValuedMap<K,V>

putAll

public void putAll(Map<? extends K,? extends Collection<V>> m)
Description copied from class: CollectionValuedMap
Unsupported. Use CollectionValuedMap.addAll(Map) instead.

Specified by:
putAll in interface Map<K,Collection<V>>
Overrides:
putAll in class CollectionValuedMap<K,V>

add

public void add(K key,
                V value)
Description copied from class: CollectionValuedMap
Adds the value to the Collection mapped to by the key.

Overrides:
add in class CollectionValuedMap<K,V>

addAll

public void addAll(Map<K,V> m)
Adds all of the mappings in m to this CollectionValuedMap. If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead.

Overrides:
addAll in class CollectionValuedMap<K,V>

remove

public Collection<V> remove(Object key)
Description copied from class: CollectionValuedMap
Removes the mapping associated with this key from this Map.

Specified by:
remove in interface Map<K,Collection<V>>
Overrides:
remove in class CollectionValuedMap<K,V>
Returns:
the Collection mapped to by this key.

removeMapping

public void removeMapping(K key,
                          V value)
Description copied from class: CollectionValuedMap
Removes the value from the Collection mapped to by this key, leaving the rest of the collection intact.

Overrides:
removeMapping in class CollectionValuedMap<K,V>
Parameters:
key - the key to the Collection to remove the value from
value - the value to remove

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,Collection<V>>
Overrides:
containsKey in class CollectionValuedMap<K,V>
Returns:
true iff this key is in this map

containsValue

public boolean containsValue(Object value)
Description copied from class: CollectionValuedMap
Unsupported.

Specified by:
containsValue in interface Map<K,Collection<V>>
Overrides:
containsValue in class CollectionValuedMap<K,V>

clear

public void clear()
This is more expensive than normal.

Specified by:
clear in interface Map<K,Collection<V>>
Overrides:
clear in class CollectionValuedMap<K,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K,Collection<V>>
Overrides:
isEmpty in class CollectionValuedMap<K,V>
Returns:
true iff this Map has no mappings in it.

size

public int size()
Description copied from class: CollectionValuedMap
The number of keys in this map.

Specified by:
size in interface Map<K,Collection<V>>
Overrides:
size in class CollectionValuedMap<K,V>

values

public Collection<Collection<V>> values()
Specified by:
values in interface Map<K,Collection<V>>
Overrides:
values in class CollectionValuedMap<K,V>
Returns:
a collection of the values (really, a collection of values) in this Map

entrySet

public Set<Map.Entry<K,Collection<V>>> entrySet()
This is cheap.

Specified by:
entrySet in interface Map<K,Collection<V>>
Overrides:
entrySet in class CollectionValuedMap<K,V>
Returns:
a set view of the mappings contained in this map.


Stanford NLP Group