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>
  • Constructor Details

    • ConcurrentInvertedRadixTreeImpl

      public ConcurrentInvertedRadixTreeImpl(NodeFactory nodeFactory)
  • Method Details

    • scanForKeysAtStartOfInput

      protected Iterable<KeyValuePair<O>> scanForKeysAtStartOfInput(CharSequence input)
      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

      protected KeyValuePair<O> scanForLongestKeyAtStartOfInput(CharSequence input)
      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 as scanForKeysAtStartOfInput(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