|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.MultiBinaryLongMap.AbstractDelegateBinaryLongMap
com.tangosol.util.MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap
protected class MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap
An extension to the DelegatingBinaryLongMap for the "primary" or "owning" BinaryLongMap that is responsible for adding and removing keys.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.tangosol.util.MultiBinaryLongMap.AbstractDelegateBinaryLongMap |
---|
MultiBinaryLongMap.AbstractDelegateBinaryLongMap.DelegateEntryVisitor |
Nested classes/interfaces inherited from interface com.tangosol.util.BinaryLongMap |
---|
BinaryLongMap.Entry, BinaryLongMap.EntryVisitor, BinaryLongMap.SimpleMapImpl |
Field Summary | |
---|---|
protected java.util.concurrent.locks.Lock |
f_lockSThis The shared lock that protects the logical contents of the primary BinaryLongMap. |
protected java.util.concurrent.locks.Lock |
f_lockXMaster The (exclusive) lock that protects the data-structures for the MultiBinaryLongMap. |
protected java.util.concurrent.locks.Lock |
f_lockXThis The exclusive lock that protects the logical contents of the primary BinaryLongMap. |
Fields inherited from class com.tangosol.util.MultiBinaryLongMap.AbstractDelegateBinaryLongMap |
---|
f_blm, f_store, m_iIndex |
Constructor Summary | |
---|---|
MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap(BinaryLongMap blmKeyTree, MultiBinaryLongMap.LongStorage store, java.util.concurrent.locks.ReentrantReadWriteLock rwLockMaster) Construct a DelegatingPrimaryBinaryLongMap. |
Method Summary | |
---|---|
protected void |
addValue(Binary binKey, long lValueNew) Add the specified key to the BinaryLongMap, and associate the specified value with it in the primary BLM. |
protected void |
checkCompaction() Check to see whether or not the LongStorage slots should be compacted. |
void |
clear() Initialize the map to an empty state. |
protected boolean |
doPut(Binary binKey, long lValue, boolean fOnlyIfAbsent) Helper method for put(com.tangosol.util.Binary, long) and putIfAbsent(com.tangosol.util.Binary, long) operations. |
long |
get(Binary binKey) Find the specified key in the map and return the value associated with it. |
void |
internKeys(java.lang.Object o) Internal opaque method: De-duplicate keys. |
java.util.Iterator |
keys() Obtain an iterator of the keys stored in the map. |
java.util.Iterator |
keys(com.oracle.common.base.Predicate predicate) Obtain an iterator of the keys stored in the map whose corresponding Entry matches the passed Predicate<Entry> . |
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. |
protected boolean |
removeValue(Binary binKey, long lValue) Remove the specified key from the BinaryLongMap, optionally performing the operation only if the value currently associated with the key matches the passed "old" value. |
boolean |
replace(Binary binKey, long lValueOld, long lValueNew) Store the passed "new" value for the specified key, only if the current value associated with the specified key is the same as the specified "old" value. |
int |
size() Determine the size of the map. |
void |
visit(Binary binKey, BinaryLongMap.EntryVisitor visitor) Apply the specified visitor to the entry associated with the specified key, if the entry exists or may be added. |
void |
visitAll(BinaryLongMap.EntryVisitor visitor) Apply the specified visitor to all entries in the BinaryLongMap. |
Methods inherited from class com.tangosol.util.MultiBinaryLongMap.AbstractDelegateBinaryLongMap |
---|
getIndex, getSlot, setIndex, updateValue |
Field Detail |
---|
protected final java.util.concurrent.locks.Lock f_lockXMaster
protected final java.util.concurrent.locks.Lock f_lockSThis
protected final java.util.concurrent.locks.Lock f_lockXThis
Constructor Detail |
---|
public MultiBinaryLongMap.PrimaryBinaryLongMap.DelegatingPrimaryBinaryLongMap(BinaryLongMap blmKeyTree, MultiBinaryLongMap.LongStorage store, java.util.concurrent.locks.ReentrantReadWriteLock rwLockMaster)
blmKeyTree
- the BinaryLongMap that holds the keys for this mapstore
- the LongStorage that holds the values for this maprwLockMaster
- the "master" ReentrantReadWriteLock protecting the underlying MLBM BRT and LongStorage structuresMethod Detail |
---|
public long get(Binary binKey)
get
in interface BinaryLongMap
get
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
binKey
- a Binary keypublic void put(Binary binKey, long lValue)
Note that associating the value zero with a key is analogous to removing the key.
binKey
- the Binary key to add or updatelValue
- the value to associate with the keypublic void remove(Binary binKey)
binKey
- a Binary keypublic boolean remove(Binary binKey, long lValue)
Note that removing an association whose value is zero has no effect.
binKey
- a Binary keylValue
- the value that the key must have in order to be removedpublic boolean putIfAbsent(Binary binKey, long lValue)
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).
binKey
- a Binary keylValue
- the new value to associate with the passed keypublic boolean replace(Binary binKey, long lValueOld, long lValueNew)
Note that replacing the value of zero is analogous to putIfAbsent
, and associating the value zero with a key using this method is the same as remove
passing the old value to match.
binKey
- a Binary keylValueOld
- the assumed old value to replacelValueNew
- the new value to associate with the passed keypublic void clear()
public int size()
public java.util.Iterator keys()
keys
in interface BinaryLongMap
keys
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
public java.util.Iterator keys(com.oracle.common.base.Predicate predicate)
Entry
matches the passed Predicate<Entry>
.
The entry passed to the predicate should be treated as read-only, and any attempt to modify the entry may have undefined behavior and/or throw an Exception. Modifications to entries should instead be performed using an BinaryLongMap.EntryVisitor
via the BinaryLongMap.visit(com.tangosol.util.Binary, com.tangosol.util.BinaryLongMap.EntryVisitor)
or BinaryLongMap.visitAll(com.tangosol.util.BinaryLongMap.EntryVisitor)
methods.
keys
in interface BinaryLongMap
keys
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
predicate
- a Predicate<Entry> to apply to each Entrypublic void visit(Binary binKey, BinaryLongMap.EntryVisitor visitor)
BinaryLongMap.Entry.setValue(long)
).visit
in interface BinaryLongMap
visit
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
binKey
- the key to visitvisitor
- the visitor to applypublic void visitAll(BinaryLongMap.EntryVisitor visitor)
visitAll
in interface BinaryLongMap
visitAll
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
visitor
- the visitor to applypublic void internKeys(java.lang.Object o)
internKeys
in interface BinaryLongMap
internKeys
in class MultiBinaryLongMap.AbstractDelegateBinaryLongMap
o
- some implementation-specific objectprotected boolean doPut(Binary binKey, long lValue, boolean fOnlyIfAbsent)
put(com.tangosol.util.Binary, long)
and putIfAbsent(com.tangosol.util.Binary, long)
operations.binKey
- the key to add to the maplValue
- the value to be associatedfOnlyIfAbsent
- true iff the key/value should be associated only if the key was previously absentprotected void addValue(Binary binKey, long lValueNew)
The caller is responsible for holding the exclusive lock protecting the key tree and LongStorage.
binKey
- the key to add to the BinaryLongMaplValueNew
- the new value to associate with the keyprotected boolean removeValue(Binary binKey, long lValue)
The caller is responsible for holding the exclusive lock protecting the key tree and LongStorage.
binKey
- the keylValue
- the value that is assumed to be currently associated with the key, or 0 if the key should be removed unconditionallyprotected void checkCompaction()
The caller is responsible for holding the exclusive lock protecting the key tree and LongStorage.
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |