jpaul.DataStructs
Class BijMap<A,B>

java.lang.Object
  extended by jpaul.DataStructs.MapWrapper<A,B>
      extended by jpaul.DataStructs.BijMap<A,B>
All Implemented Interfaces:
java.util.Map<A,B>

public class BijMap<A,B>
extends MapWrapper<A,B>

BijMap

Version:
$Id: BijMap.java,v 1.4 2006/03/14 02:29:30 salcianu Exp $
Author:
Alexandru Salcianu - salcianu@alum.mit.edu

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class jpaul.DataStructs.MapWrapper
map
 
Constructor Summary
BijMap()
           
BijMap(MapFactory<A,B> mapFact, MapFactory<B,A> revMapFact)
          Creates a BijMap.
 
Method Summary
 void clear()
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<A,B>> entrySet()
          Returns a set view of the entries from this BijMap.
 java.util.Set<A> keySet()
           
 B put(A key, B value)
           
 void putAll(java.util.Map<? extends A,? extends B> t)
           
 B remove(java.lang.Object key)
           
 BijMap<B,A> rev()
          Returns a reverse view of this BijMap.
 int size()
           
 java.util.Collection<B> values()
          Returns a collection view of the values from this BijMap.
 
Methods inherited from class jpaul.DataStructs.MapWrapper
containsKey, equals, get, hashCode, isEmpty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BijMap

public BijMap(MapFactory<A,B> mapFact,
              MapFactory<B,A> revMapFact)
Creates a BijMap.


BijMap

public BijMap()
Method Detail

rev

public BijMap<B,A> rev()
Returns a reverse view of this BijMap. The returned view is fully functional (i.e., allows mutation) and connected to this bijective map (i.e., changes in one of them are reflected in the other one).


clear

public void clear()
Specified by:
clear in interface java.util.Map<A,B>
Overrides:
clear in class MapWrapper<A,B>

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map<A,B>
Overrides:
containsValue in class MapWrapper<A,B>

entrySet

public java.util.Set<java.util.Map.Entry<A,B>> entrySet()
Returns a set view of the entries from this BijMap. The view is fully functional (i.e., allows mutation) and connected to this bijective map (i.e., changes in one of them are reflected in the other one).

Specified by:
entrySet in interface java.util.Map<A,B>
Overrides:
entrySet in class MapWrapper<A,B>

keySet

public java.util.Set<A> keySet()
Specified by:
keySet in interface java.util.Map<A,B>
Overrides:
keySet in class MapWrapper<A,B>

put

public B put(A key,
             B value)
Specified by:
put in interface java.util.Map<A,B>
Overrides:
put in class MapWrapper<A,B>

putAll

public void putAll(java.util.Map<? extends A,? extends B> t)
Specified by:
putAll in interface java.util.Map<A,B>
Overrides:
putAll in class MapWrapper<A,B>

remove

public B remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map<A,B>
Overrides:
remove in class MapWrapper<A,B>

size

public int size()
Specified by:
size in interface java.util.Map<A,B>
Overrides:
size in class MapWrapper<A,B>

values

public java.util.Collection<B> values()
Returns a collection view of the values from this BijMap. The view is fully functional (i.e., allows mutation) and connected to this bijective map (i.e., changes in one of them are reflected in the other one).

Specified by:
values in interface java.util.Map<A,B>
Overrides:
values in class MapWrapper<A,B>


Copyright 2005 Alexandru Salcianu - salcianu@alum.mit.edu