public class TransactionalMultimap<K,V> extends SemiPersistent<TransactionalMultimap<K,V>> implements OpaqueMultimap<K,V>
| Constructor and Description |
|---|
TransactionalMultimap()
Constructs a new empty
TransactionalMultimap. |
| Modifier and Type | Method and Description |
|---|---|
protected TransactionalMultimap<K,V> |
cleanCopy()
Creates a new transactional entity from the current one discarding all the local changes.
|
void |
clear()
Removes all of the mappings from this map (optional operation).
|
TransactionalMultimap<K,V> |
commit(TransactionalMultimap<K,V> globalState) |
boolean |
containsKey(K key)
Returns true if this map contains a mapping for the specified key.
|
protected TransactionalMultimap<K,V> |
dirtyCopy()
Copies references to the source data along with local changes and read/write logs.
|
Set<V> |
get(K key)
Delegates to
TransactionalMap.get(Object) replacing the returned null value with an empty
set. |
boolean |
isEmpty()
Delegates to
TransactionalMap.isEmpty(). |
Set<K> |
keySet()
Delegates to
TransactionalMap.keySet(). |
Set<V> |
put(K key,
V value)
Adds the value to the entry with the given key.
|
Set<V> |
putAll(K key,
Collection<V> values)
Puts all the values in the collection with the given key.
|
void |
putAll(Map<? extends K,? extends Set<V>> map)
Overrides the default behavior of the method by merging the immutable sets for the same key.
|
Set<V> |
remove(K key)
Delegates to
TransactionalMap.remove(Object) replacing the returned null value with an empty
set. |
Set<V> |
remove(K key,
V value)
Removes the given value from the entry with the given key.
|
int |
size()
Delegates to
TransactionalMap.size(). |
protected void |
update(TransactionalMultimap<K,V> changes,
boolean onlyReadLogs)
Updates local changes and change logs using change logs of the arguments.
|
public TransactionalMultimap()
TransactionalMultimap.public int size()
TransactionalMap.size().size in interface OpaqueMultimap<K,V>public boolean isEmpty()
TransactionalMap.isEmpty().isEmpty in interface OpaqueMultimap<K,V>public Set<V> get(K key)
TransactionalMap.get(Object) replacing the returned null value with an empty
set.get in interface OpaqueMultimap<K,V>key - the key whose associated value is to be returnednull if this map contains no mapping for the
keypublic Set<V> remove(K key)
TransactionalMap.remove(Object) replacing the returned null value with an empty
set.remove in interface OpaqueMultimap<K,V>key - key whose mapping is to be removed from the mappublic void clear()
OpaqueMultimapclear in interface OpaqueMultimap<K,V>public boolean containsKey(K key)
OpaqueMultimapcontainsKey in interface OpaqueMultimap<K,V>key - key whose presence in this map is to be testedpublic void putAll(Map<? extends K,? extends Set<V>> map)
putAll in interface OpaqueMultimap<K,V>map - mappings to be stored in this mappublic Set<K> keySet()
TransactionalMap.keySet().keySet in interface OpaqueMultimap<K,V>public Set<V> put(K key, V value)
put in interface OpaqueMultimap<K,V>key - The key that the set is stored under.value - The value that is added to the entry with the given key.public Set<V> putAll(K key, Collection<V> values)
key - The key that the set is stored under.values - The values that are added to the entry with the given key.public Set<V> remove(K key, V value)
key - The key to retrieve the set.value - Value to be removed from the set.public TransactionalMultimap<K,V> commit(TransactionalMultimap<K,V> globalState)
protected TransactionalMultimap<K,V> cleanCopy()
SemiPersistentcleanCopy in class SemiPersistent<TransactionalMultimap<K,V>>protected TransactionalMultimap<K,V> dirtyCopy()
SemiPersistentSemiPersistent#update(Object) will not work.dirtyCopy in class SemiPersistent<TransactionalMultimap<K,V>>protected void update(TransactionalMultimap<K,V> changes, boolean onlyReadLogs)
SemiPersistentSemiPersistent.dirtyCopy(). update in class SemiPersistent<TransactionalMultimap<K,V>>changes - The branched collection possibly with updates.onlyReadLogs - If true only read logs are updated. Useful for read-only transactions.Copyright © 2013 CERN, The European Organization for Nuclear Research. All Rights Reserved.