Class ConcurrentInvertedRadixTree.ConcurrentInvertedRadixTreeImpl<O>
java.lang.Object
com.googlecode.concurrenttrees.radix.ConcurrentRadixTree<O>
com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree.ConcurrentInvertedRadixTreeImpl<O>
- All Implemented Interfaces:
PrettyPrintable
,RadixTree<O>
,Serializable
- Enclosing class:
ConcurrentInvertedRadixTree<O>
static class ConcurrentInvertedRadixTree.ConcurrentInvertedRadixTreeImpl<O>
extends ConcurrentRadixTree<O>
-
Nested Class Summary
Nested classes/interfaces inherited from class com.googlecode.concurrenttrees.radix.ConcurrentRadixTree
ConcurrentRadixTree.KeyValuePairImpl<O>, ConcurrentRadixTree.NodeKeyPair
-
Field Summary
Fields inherited from class com.googlecode.concurrenttrees.radix.ConcurrentRadixTree
root
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Iterable
<KeyValuePair<O>> Lazily traverses the tree based on characters in the given input, and returns from the tree the next node and its value where the key associated with the node matches the characters from the input.protected KeyValuePair
<O> Traverses the tree based on characters in the given input, and returns the longest key in the tree which is a prefix of the input, and its associated value.Methods inherited from class com.googlecode.concurrenttrees.radix.ConcurrentRadixTree
acquireWriteLock, getClosestKeys, getKeysStartingWith, getKeyValuePairsForClosestKeys, getKeyValuePairsForKeysStartingWith, getNode, getValueForExactKey, getValuesForClosestKeys, getValuesForKeysStartingWith, lazyTraverseDescendants, put, putIfAbsent, releaseWriteLock, remove, size, transformKeyForResult
-
Constructor Details
-
ConcurrentInvertedRadixTreeImpl
-
-
Method Details
-
scanForKeysAtStartOfInput
Lazily traverses the tree based on characters in the given input, and returns from the tree the next node and its value where the key associated with the node matches the characters from the input. More than one matching keyword can be found for the same input, if there are keys in the tree which are prefixes of each other. Example:
Given two keywords in the tree: "Ford" and "Ford Focus"
Given a document: "I am shopping for a Ford Focus car"
Where the given input in this instance is the suffix of the document: "Ford Focus car"
...then this method will return both "Ford" and "Ford Focus".
The caller can invoke this method repeatedly for each suffix of the document.- Parameters:
input
- A sequence of characters which controls traversal of the tree- Returns:
- An iterable which will search for the next node in the tree matching the input
-
scanForLongestKeyAtStartOfInput
Traverses the tree based on characters in the given input, and returns the longest key in the tree which is a prefix of the input, and its associated value. This uses a similar algorithm asscanForKeysAtStartOfInput(CharSequence)
except it returns the last result that would be returned, however this algorithm locates the last node more efficiently by creating garbage objects during traversal due to not having to return the intermediate results.- Parameters:
input
- A sequence of characters which controls traversal of the tree- Returns:
- The longest key in the tree which is a prefix of the input, and its associated value; or null if no such key is contained in the tree
-