common
Interface MultiMapDiff

All Superinterfaces:
java.util.Map, MultiMap
All Known Implementing Classes:
HashMultiMapDiff, IndexedMultiMapDiff

public interface MultiMapDiff
extends MultiMap

A MultiMap that is represented as a set of changes to some underlying MultiMap. The changes are additions and removals on the sets of objects associated with various keys. When using a MultiMapDiff, we do not need to copy any information for keys whose associated sets do not change. And for a keys whose set does change, we still do not need to copy all the objects that are in that set in both the underlying world and the MultiMapDiff.


Nested Class Summary
 
Nested classes/interfaces inherited from interface common.MultiMap
MultiMap.EmptyMultiMap
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from interface common.MultiMap
EMPTY_MULTI_MAP
 
Method Summary
 void changeUnderlying()
          Changes the underlying multi-map to equal this multi-map.
 void clearChanges()
          Resets this multi-map to be equal to the underlying multi-map.
 java.util.Set getAddedValues(java.lang.Object key)
          Returns the set of values that are associated with the given key in this multi-map and not in the underlying multi-map.
 java.util.Set getChangedKeys()
          Returns the set of keys whose associated value sets are different in this multi-map and the underlying multi-map.
 java.util.Set getRemovedValues(java.lang.Object key)
          Returns the set of values that are associated with the given key in the underlying multi-map but not in this multi-map.
 
Methods inherited from interface common.MultiMap
add, addAll, get, put, remove, removeAll
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Method Detail

getChangedKeys

java.util.Set getChangedKeys()
Returns the set of keys whose associated value sets are different in this multi-map and the underlying multi-map. This includes keys that were added or removed.

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

Returns:
unmodifiable Set of Objects

getAddedValues

java.util.Set getAddedValues(java.lang.Object key)
Returns the set of values that are associated with the given key in this multi-map and not in the underlying multi-map. Returns an empty set if the key is not in this multi-map.

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

Returns:
unmodifiable Set of Objects

getRemovedValues

java.util.Set getRemovedValues(java.lang.Object key)
Returns the set of values that are associated with the given key in the underlying multi-map but not in this multi-map. Returns an empty set if the key is not in the underlying multi-map.

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

Returns:
unmodifiable Set of Objects

changeUnderlying

void changeUnderlying()
Changes the underlying multi-map to equal this multi-map.


clearChanges

void clearChanges()
Resets this multi-map to be equal to the underlying multi-map.