|
|||||||||
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.Map
size
in class java.util.AbstractMap
public boolean isEmpty()
isEmpty
in interface java.util.Map
isEmpty
in class java.util.AbstractMap
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
containsKey
in class java.util.AbstractMap
public boolean containsValue(java.lang.Object v)
containsValue
in interface java.util.Map
containsValue
in class java.util.AbstractMap
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map
get
in class java.util.AbstractMap
public java.lang.Object put(java.lang.Object key, java.lang.Object newVal)
put
in interface java.util.Map
put
in class java.util.AbstractMap
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
remove
in class java.util.AbstractMap
public void clear()
clear
in interface java.util.Map
clear
in class java.util.AbstractMap
public java.util.Set keySet()
keySet
in interface java.util.Map
keySet
in class java.util.AbstractMap
public java.util.Collection values()
values
in interface java.util.Map
values
in class java.util.AbstractMap
public java.util.Set entrySet()
entrySet
in interface java.util.Map
entrySet
in class java.util.AbstractMap
public java.util.Set valueSet()
MapWithPreimages
values
method in the Map
interface
in that it returns a Set rather than a Collection.
valueSet
in interface MapWithPreimages
public java.util.Set getPreimage(java.lang.Object value)
MapWithPreimages
v
. If no keys
map to v
, this is the empty set.
getPreimage
in interface MapWithPreimages
public MultiMap getPreimages()
MapWithPreimages
getPreimages
in interface MapWithPreimages
public boolean isCorefPair(java.lang.Object k1, java.lang.Object k2)
MapWithPreimages
k1
and k2
are coreferent,
that is, they are both keys that map to the same value.
isCorefPair
in interface MapWithPreimages
public int numCorefPairs()
MapWithPreimages
Note 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 |