Package jadex.commons.collection
Class RwMapWrapper<K,V>
- java.lang.Object
 - 
- jadex.commons.collection.RwMapWrapper<K,V>
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<K,V>mapThe wrapped map.protected RwAutoLockrwautolock 
- 
Constructor Summary
Constructors Constructor Description RwMapWrapper(java.util.Map<K,V> map)Creates the wrapper.RwMapWrapper(java.util.Map<K,V> map, boolean fair)Creates the wrapper.RwMapWrapper(java.util.Map<K,V> map, java.util.concurrent.locks.ReadWriteLock lock)Creates the wrapper with a specific internal lock. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the map.booleancontainsKey(java.lang.Object key)Returns if the map contains a key.booleancontainsValue(java.lang.Object value)Returns if the map contains a value.java.util.Set<java.util.Map.Entry<K,V>>entrySet()Returns the entry set.Vget(java.lang.Object key)Gets the value for the key.java.util.concurrent.locks.ReadWriteLockgetLock()Gets the internal lock.java.util.concurrent.locks.LockgetReadLock()Gets the read lock for manual locking.java.util.concurrent.locks.LockgetWriteLock()Gets the write lock for manual locking.booleanisEmpty()Returns if map is empty.java.util.Set<K>keySet()Returns the key set.Vput(K key, V value)Puts a key-value pair.voidputAll(java.util.Map<? extends K,? extends V> m)Puts all key-value pairs into map.IAutoLockreadLock()Locks the read lock for resource-based locking.Vremove(java.lang.Object key)Removes a key-value pair.intsize()Returns the size of the map.java.util.Collection<V>values()Returns the key values.IAutoLockwriteLock()Locks the write lock for resource-based locking. 
 - 
 
- 
- 
Field Detail
- 
rwautolock
protected RwAutoLock rwautolock
 
 - 
 
- 
Constructor Detail
- 
RwMapWrapper
public RwMapWrapper(java.util.Map<K,V> map)
Creates the wrapper.- Parameters:
 map- The wrapped map.
 
- 
RwMapWrapper
public RwMapWrapper(java.util.Map<K,V> map, java.util.concurrent.locks.ReadWriteLock lock)
Creates the wrapper with a specific internal lock.- Parameters:
 map- The wrapped map.
 
 - 
 
- 
Method Detail
- 
size
public int size()
Returns the size of the map. 
- 
isEmpty
public boolean isEmpty()
Returns if map is empty. 
- 
containsKey
public boolean containsKey(java.lang.Object key)
Returns if the map contains a key. 
- 
containsValue
public boolean containsValue(java.lang.Object value)
Returns if the map contains a value. 
- 
get
public V get(java.lang.Object key)
Gets the value for the key. 
- 
remove
public V remove(java.lang.Object key)
Removes a key-value pair. 
- 
putAll
public void putAll(java.util.Map<? extends K,? extends V> m)
Puts all key-value pairs into map. 
- 
keySet
public java.util.Set<K> keySet()
Returns the key set. Warning: Use manual locking. 
- 
values
public java.util.Collection<V> values()
Returns the key values. Warning: Use manual locking. 
- 
entrySet
public java.util.Set<java.util.Map.Entry<K,V>> entrySet()
Returns the entry set. Warning: Use manual locking. 
- 
readLock
public IAutoLock readLock()
Locks the read lock for resource-based locking. 
- 
writeLock
public IAutoLock writeLock()
Locks the write lock for resource-based locking. 
- 
getReadLock
public java.util.concurrent.locks.Lock getReadLock()
Gets the read lock for manual locking.- Specified by:
 getReadLockin interfaceIRwMap<K,V>
 
- 
getWriteLock
public java.util.concurrent.locks.Lock getWriteLock()
Gets the write lock for manual locking.- Specified by:
 getWriteLockin interfaceIRwMap<K,V>
 
 - 
 
 -