Package com.tangosol.util
Class MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap
- java.lang.Object
-
- com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap
-
- com.tangosol.util.MultiBinaryLongMap.SafeBinaryLongMap
-
- com.tangosol.util.MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap
-
- All Implemented Interfaces:
BinaryLongMap
- Enclosing class:
- MultiBinaryLongMap.PrimaryBinaryLongMap
protected class MultiBinaryLongMap.PrimaryBinaryLongMap.CompressedPrimaryBinaryLongMap extends MultiBinaryLongMap.SafeBinaryLongMap
The CompressedPrimaryBinaryLongMap is a trivial "Safe" wrapper around the main key-tree, which associates keys to their single (primary) long value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap
MultiBinaryLongMap.WrapperBinaryLongMap.WrapperIterator
-
Nested classes/interfaces inherited from interface com.tangosol.util.BinaryLongMap
BinaryLongMap.Entry, BinaryLongMap.EntryVisitor, BinaryLongMap.SimpleMapImpl
-
-
Field Summary
-
Fields inherited from class com.tangosol.util.MultiBinaryLongMap.SafeBinaryLongMap
f_lockExclusive, f_lockShared
-
Fields inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap
m_blm
-
-
Constructor Summary
Constructors Constructor Description CompressedPrimaryBinaryLongMap(BinaryLongMap blmKeyTree, ReentrantReadWriteLock rwLock)
Construct a CompressedPrimaryBinaryLongMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Initialize the map to an empty state.void
put(Binary binKey, long lValue)
Blindly store the passed value for the specified key, adding the key if it is not already in the map, or replacing the current value if the key is in the map.boolean
putIfAbsent(Binary binKey, long lValue)
Store the passed value for the specified key, only if the key does not currently exist in the map.void
remove(Binary binKey)
Blindly remove the specified Binary key from the map.boolean
remove(Binary binKey, long lValue)
Remove the specified Binary key from the map iff it exists in the map and is associated with the specified value.-
Methods inherited from class com.tangosol.util.MultiBinaryLongMap.SafeBinaryLongMap
get, getMap, internKeys, keys, keys, release, replace, size, visit, visitAll
-
Methods inherited from class com.tangosol.util.MultiBinaryLongMap.WrapperBinaryLongMap
setMap
-
-
-
-
Constructor Detail
-
CompressedPrimaryBinaryLongMap
public CompressedPrimaryBinaryLongMap(BinaryLongMap blmKeyTree, ReentrantReadWriteLock rwLock)
Construct a CompressedPrimaryBinaryLongMap.- Parameters:
blmKeyTree
- the BinaryLongMap holding the keys for the outer MultiBinaryLongMaprwLock
- the master ReadWriteReentrantLock
-
-
Method Detail
-
put
public void put(Binary binKey, long lValue)
Blindly store the passed value for the specified key, adding the key if it is not already in the map, or replacing the current value if the key is in the map.Note that associating the value zero with a key is analogous to removing the key.
- Specified by:
put
in interfaceBinaryLongMap
- Overrides:
put
in classMultiBinaryLongMap.SafeBinaryLongMap
- Parameters:
binKey
- the Binary key to add or updatelValue
- the value to associate with the key
-
putIfAbsent
public boolean putIfAbsent(Binary binKey, long lValue)
Store the passed value for the specified key, only if the key does not currently exist in the map.Note that associating the value zero with a key using this method will have no effect, since were that key already present, there would be no change, and were it not present, the value zero is analogous to removing the key, which again is no change (since it is not present).
- Specified by:
putIfAbsent
in interfaceBinaryLongMap
- Overrides:
putIfAbsent
in classMultiBinaryLongMap.SafeBinaryLongMap
- Parameters:
binKey
- a Binary keylValue
- the new value to associate with the passed key- Returns:
- true iff the key was not present in the map, and now it is present in the map associated with the passed value
-
remove
public void remove(Binary binKey)
Blindly remove the specified Binary key from the map.- Specified by:
remove
in interfaceBinaryLongMap
- Overrides:
remove
in classMultiBinaryLongMap.SafeBinaryLongMap
- Parameters:
binKey
- a Binary key
-
remove
public boolean remove(Binary binKey, long lValue)
Remove the specified Binary key from the map iff it exists in the map and is associated with the specified value.Note that removing an association whose value is zero has no effect.
- Specified by:
remove
in interfaceBinaryLongMap
- Overrides:
remove
in classMultiBinaryLongMap.SafeBinaryLongMap
- Parameters:
binKey
- a Binary keylValue
- the value that the key must have in order to be removed- Returns:
- true iff the map contained the key, it was associated with the specified value, and has now been removed
-
clear
public void clear()
Initialize the map to an empty state.- Specified by:
clear
in interfaceBinaryLongMap
- Overrides:
clear
in classMultiBinaryLongMap.SafeBinaryLongMap
-
-