|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.BinaryRadixTree
public class BinaryRadixTree
A BinaryRadixTree is a memory-optimized radix tree (aka a Patricia trie) that is intended to efficiently store a mapping from Binary values to long values. The BinaryRadixTree is not thread safe; to make it safe in a multi-threaded scenario, access must by synchronized and the Iterators returned from the BinaryRadixTree can only be used within the scope of synchronization within which they were obtained.
Nested Class Summary | |
---|---|
protected class |
BinaryRadixTree.AllKeyIterator An Iterator that iterates all of the Binary keys in the radix tree. |
static class |
BinaryRadixTree.BinaryLongMap A Map of Binary to Long. |
protected class |
BinaryRadixTree.FilteredIterator An Iterator that iterates only the Binary keys in the radix tree whose associated value matches (via some bit-mask) a specified value. |
protected class |
BinaryRadixTree.KeyIterator An Iterator that iterates Binary keys from Nodes. |
Constructor Summary | |
---|---|
BinaryRadixTree() Construct an empty BinaryRadixTree. |
Method Summary | |
---|---|
void |
clear() Initialize the tree to an empty state. |
java.util.Iterator |
findAll(long lMask, long lValue) Obtain an iterator of all of the keys that have values that match the specified value as seen through the passed bit-mask. |
long |
get(Binary binKey) Find the specified key in the tree and return the value associated with it. |
void |
internKeys(byte[][] aab) To reduce memory footprint, the tree supports de-duplication of byte[] values used internally by the tree. |
java.util.Iterator |
keys() Obtain an iterator of the keys stored in the tree. |
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 tree, or replacing the current value if the key is in the tree. |
boolean |
putIfAbsent(Binary binKey, long lValue) Store the passed value for the specified key, only if the key does not currently exist in the tree. |
void |
remove(Binary binKey) Blindly remove the specified Binary key from the tree. |
boolean |
remove(Binary binKey, long lValue) Remove the specified Binary key from the tree iff it exists in the tree and is associated with the specified 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 tree. |
Constructor Detail |
---|
public BinaryRadixTree()
Method Detail |
---|
public long get(Binary binKey)
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 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 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 void clear()
public int size()
public java.util.Iterator keys()
public java.util.Iterator findAll(long lMask, long lValue)
lMask
- a long bit-mask valuelValue
- a long value to compare topublic void internKeys(byte[][] aab)
Do not pre-populate the byte[][] or modify any of its contents.
Note: This method does not require external synchronization.
aab
- an opaque array used to accumulate "intern()" byte[] values
|
Oracle® Coherence Java API Reference Release 3.7.1.0 E22843-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |