harpoon.Util.Collections
Class GenericInvertibleMap

java.lang.Object
  |
  +--harpoon.Util.Collections.MapWrapper
        |
        +--harpoon.Util.Collections.GenericInvertibleMap
All Implemented Interfaces:
InvertibleMap, Map

public class GenericInvertibleMap
extends MapWrapper
implements InvertibleMap

GenericInvertibleMap is a default implementation of InvertibleMap. It returns unmodifiable inverted views of the mappings it maintains.

Version:
$Id: GenericInvertibleMap.java,v 1.2 2002/02/25 21:09:04 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Nested Class Summary
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
GenericInvertibleMap()
          Constructs an invertible map backed by a HashMap.
GenericInvertibleMap(Map m)
           
GenericInvertibleMap(MapFactory mf, MultiMap.Factory mmf)
          Constructs an invertible map backed by a map constructed by mf and an inverted map constructed by mmf.
 
Method Summary
 MultiMap invert()
          Returns an unmodifiable inverted view of this.
 Object put(Object key, Object value)
           
 void putAll(Map m)
           
 Object remove(Object key)
           
 
Methods inherited from class harpoon.Util.Collections.MapWrapper
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, toString, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values
 

Constructor Detail

GenericInvertibleMap

public GenericInvertibleMap()
Constructs an invertible map backed by a HashMap.


GenericInvertibleMap

public GenericInvertibleMap(MapFactory mf,
                            MultiMap.Factory mmf)
Constructs an invertible map backed by a map constructed by mf and an inverted map constructed by mmf.


GenericInvertibleMap

public GenericInvertibleMap(Map m)
Method Detail

invert

public MultiMap invert()
Returns an unmodifiable inverted view of this.

Specified by:
invert in interface InvertibleMap

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map
Overrides:
put in class MapWrapper

putAll

public void putAll(Map m)
Specified by:
putAll in interface Map
Overrides:
putAll in class MapWrapper

remove

public Object remove(Object key)
Specified by:
remove in interface Map
Overrides:
remove in class MapWrapper