|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.concurrenttrees.radixreversed.ConcurrentReversedRadixTree<O>
public class ConcurrentReversedRadixTree<O>
An implementation of ReversedRadixTree which supports lock-free concurrent reads, and allows items to be added
to and to be removed from the tree atomically by background thread(s), without blocking reads.
ConcurrentRadixTree, see that class for
implementation details.
| Constructor Summary | |
|---|---|
ConcurrentReversedRadixTree(NodeFactory nodeFactory)
Creates a new ConcurrentReversedRadixTree which will use the given NodeFactory to create nodes. |
|
ConcurrentReversedRadixTree(NodeFactory nodeFactory,
boolean restrictConcurrency)
Creates a new ConcurrentReversedRadixTree which will use the given NodeFactory to create nodes. |
|
| Method Summary | |
|---|---|
Iterable<CharSequence> |
getKeysEndingWith(CharSequence suffix)
Returns a lazy iterable which returns the set of keys in the tree which end with the given suffix. |
Iterable<KeyValuePair<O>> |
getKeyValuePairsForKeysEndingWith(CharSequence suffix)
Returns a lazy iterable which returns the set of KeyValuePairs for keys and their associated values
in the tree, where the keys end with the given suffix. |
Node |
getNode()
|
O |
getValueForExactKey(CharSequence key)
Returns the value associated with the given key (exact match), or returns null if no such value is associated with the key. |
Iterable<O> |
getValuesForKeysEndingWith(CharSequence suffix)
Returns a lazy iterable which returns the set of values associated with keys in the tree which end with the given suffix. |
O |
put(CharSequence key,
O value)
Associates the given value with the given key; replacing any previous value associated with the key. |
O |
putIfAbsent(CharSequence key,
O value)
If a value is not already associated with the given key in the tree, associates the given value with the key; otherwise if an existing value is already associated, returns the existing value and does not overwrite it. |
boolean |
remove(CharSequence key)
Removes the value associated with the given key (exact match). |
int |
size()
Counts the number of keys/values stored in the tree. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConcurrentReversedRadixTree(NodeFactory nodeFactory)
ConcurrentReversedRadixTree which will use the given NodeFactory to create nodes.
nodeFactory - An object which creates Node objects on-demand, and which might return node
implementations optimized for storing the values supplied to it for the creation of each node
public ConcurrentReversedRadixTree(NodeFactory nodeFactory,
boolean restrictConcurrency)
ConcurrentReversedRadixTree which will use the given NodeFactory to create nodes.
nodeFactory - An object which creates Node objects on-demand, and which might return node
implementations optimized for storing the values supplied to it for the creation of each noderestrictConcurrency - If true, configures use of a ReadWriteLock allowing
concurrent reads, except when writes are being performed by other threads, in which case writes block all reads;
if false, configures lock-free reads; allows concurrent non-blocking reads, even if writes are being performed
by other threads| Method Detail |
|---|
public O getValueForExactKey(CharSequence key)
getValueForExactKey in interface ReversedRadixTree<O>key - The key with which a sought value might be associated
public O put(CharSequence key,
O value)
put in interface ReversedRadixTree<O>key - The key with which the specified value should be associatedvalue - The value to associate with the key, which cannot be null
public O putIfAbsent(CharSequence key,
O value)
putIfAbsent in interface ReversedRadixTree<O>key - The key with which the specified value should be associatedvalue - The value to associate with the key, which cannot be null
public Iterable<CharSequence> getKeysEndingWith(CharSequence suffix)
getKeysEndingWith in interface ReversedRadixTree<O>suffix - A suffix of sought keys in the tree
public Iterable<O> getValuesForKeysEndingWith(CharSequence suffix)
#equals(Object)).
getValuesForKeysEndingWith in interface ReversedRadixTree<O>suffix - A suffix of keys in the tree for which associated values are sought
public Iterable<KeyValuePair<O>> getKeyValuePairsForKeysEndingWith(CharSequence suffix)
KeyValuePairs for keys and their associated values
in the tree, where the keys end with the given suffix.
This is inclusive - if the given suffix is an exact match for a key in the tree, the KeyValuePair
for that key is also returned.
getKeyValuePairsForKeysEndingWith in interface ReversedRadixTree<O>suffix - A suffix of keys in the tree for which associated KeyValuePairs are sought
KeyValuePairs for keys in the tree which end with the given suffix, inclusivepublic boolean remove(CharSequence key)
remove in interface ReversedRadixTree<O>key - The key for which an associated value should be removed
public int size()
size in interface ReversedRadixTree<O>public Node getNode()
getNode in interface PrettyPrintable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||