common
Class MapWithPreimagesDiff

java.lang.Object
  extended by java.util.AbstractMap
      extended by common.AbstractMapWithPreimages
          extended by common.MapWithPreimagesDiff
All Implemented Interfaces:
MapDiff, MapWithPreimages, java.util.Map

public class MapWithPreimagesDiff
extends AbstractMapWithPreimages
implements MapDiff

Represents a map with preimages as a set of differences relative to an underlying map with preimages. Uses a HashMapDiff for the forward mapping and a HashMultiMapDiff for the reverse mapping.


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 java.util.Map
java.util.Map.Entry<K,V>
 
Nested classes/interfaces inherited from interface common.MapWithPreimages
MapWithPreimages.EmptyMapWithPreimages
 
Field Summary
 
Fields inherited from class common.AbstractMapWithPreimages
map, preimages
 
Fields inherited from interface common.MapWithPreimages
EMPTY_MAP_WITH_PREIMAGES
 
Constructor Summary
MapWithPreimagesDiff(MapWithPreimages underlying)
          Creates a MapWithPreimagesDiff with the given underlying MapWithPreimages.
 
Method Summary
 void changeUnderlying()
          Changes the underlying map so it is equal to this map.
 void clearChanges()
          Resets this map so it is equal to the underlying map.
 java.util.Set getChangedKeys()
          Returns the set of keys that map to different values in this map than in the underlying map.
 
Methods inherited from class common.AbstractMapWithPreimages
clear, containsKey, containsValue, entrySet, get, getPreimage, getPreimages, isCorefPair, isEmpty, keySet, numCorefPairs, put, remove, size, values, valueSet
 
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
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

MapWithPreimagesDiff

public MapWithPreimagesDiff(MapWithPreimages underlying)
Creates a MapWithPreimagesDiff with the given underlying MapWithPreimages. Initially, this object represents no differences relative to the underlying map.

Method Detail

getChangedKeys

public java.util.Set getChangedKeys()
Description copied from interface: MapDiff
Returns the set of keys that map to different values in this map than in the underlying map. This includes any keys that have values in this map but not the underlying map, or vice versa.

The returned set may or may not be kept up to date as changes are made to this MapDiff.

Specified by:
getChangedKeys in interface MapDiff
Returns:
unmodifiable Set of Object

changeUnderlying

public void changeUnderlying()
Description copied from interface: MapDiff
Changes the underlying map so it is equal to this map.

Specified by:
changeUnderlying in interface MapDiff

clearChanges

public void clearChanges()
Description copied from interface: MapDiff
Resets this map so it is equal to the underlying map.

Specified by:
clearChanges in interface MapDiff