|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap
common.AbstractMapWithPreimages
public abstract class AbstractMapWithPreimages
Abstract implementation of the MapWithPreimages interface. A concrete
subclass only needs to implement a constructor that initializes the
protected variables map and preimages. The
implemented methods do not support null keys or null values.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface common.MapWithPreimages |
|---|
MapWithPreimages.EmptyMapWithPreimages |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
java.util.Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected java.util.Map |
map
The map itself. |
protected MultiMap |
preimages
MultiMap from values in map to the keys for which they
serve as the value. |
| Fields inherited from interface common.MapWithPreimages |
|---|
EMPTY_MAP_WITH_PREIMAGES |
| Constructor Summary | |
|---|---|
AbstractMapWithPreimages()
|
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(java.lang.Object key)
|
boolean |
containsValue(java.lang.Object v)
|
java.util.Set |
entrySet()
|
java.lang.Object |
get(java.lang.Object key)
|
java.util.Set |
getPreimage(java.lang.Object value)
Returns the set of keys that map to v. |
MultiMap |
getPreimages()
Returns a MultiMap view of the inverse of this map. |
boolean |
isCorefPair(java.lang.Object k1,
java.lang.Object k2)
Returns true if k1 and k2 are coreferent,
that is, they are both keys that map to the same value. |
boolean |
isEmpty()
|
java.util.Set |
keySet()
|
int |
numCorefPairs()
Returns the number of two-element sets of objects {k1, k2} such that isCorefPair(k1, k2) returns true. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object newVal)
|
java.lang.Object |
remove(java.lang.Object key)
|
int |
size()
|
java.util.Collection |
values()
|
java.util.Set |
valueSet()
Returns the set of values in the map. |
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, hashCode, putAll, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode, putAll |
| Field Detail |
|---|
protected java.util.Map map
protected MultiMap preimages
map to the keys for which they
serve as the value.
| Constructor Detail |
|---|
public AbstractMapWithPreimages()
| Method Detail |
|---|
public int size()
size in interface java.util.Mapsize in class java.util.AbstractMappublic boolean isEmpty()
isEmpty in interface java.util.MapisEmpty in class java.util.AbstractMappublic boolean containsKey(java.lang.Object key)
containsKey in interface java.util.MapcontainsKey in class java.util.AbstractMappublic boolean containsValue(java.lang.Object v)
containsValue in interface java.util.MapcontainsValue in class java.util.AbstractMappublic java.lang.Object get(java.lang.Object key)
get in interface java.util.Mapget in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key,
java.lang.Object newVal)
put in interface java.util.Mapput in class java.util.AbstractMappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.AbstractMappublic void clear()
clear in interface java.util.Mapclear in class java.util.AbstractMappublic java.util.Set keySet()
keySet in interface java.util.MapkeySet in class java.util.AbstractMappublic java.util.Collection values()
values in interface java.util.Mapvalues in class java.util.AbstractMappublic java.util.Set entrySet()
entrySet in interface java.util.MapentrySet in class java.util.AbstractMappublic java.util.Set valueSet()
MapWithPreimagesvalues method in the Map interface
in that it returns a Set rather than a Collection.
valueSet in interface MapWithPreimagespublic java.util.Set getPreimage(java.lang.Object value)
MapWithPreimagesv. If no keys
map to v, this is the empty set.
getPreimage in interface MapWithPreimagespublic MultiMap getPreimages()
MapWithPreimages
getPreimages in interface MapWithPreimages
public boolean isCorefPair(java.lang.Object k1,
java.lang.Object k2)
MapWithPreimagesk1 and k2 are coreferent,
that is, they are both keys that map to the same value.
isCorefPair in interface MapWithPreimagespublic int numCorefPairs()
MapWithPreimagesNote that this is different from computing the number of ordered pairs (k1, k2) such that isCorefPair(k1, k2) returns true; then we wouldn't divide by 2 in the formula above.
numCorefPairs in interface MapWithPreimages
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||