@Test public void testGetKeyValuePairForLongestKeyPrefixing() { ConcurrentInvertedRadixTree<Integer> tree = new ConcurrentInvertedRadixTree<Integer>(getNodeFactory()); tree.put("COD", 1); tree.put("CODFISH", 2); tree.put("COFFEE", 3); tree.put("CODFISHES", 4); assertEquals("(COD, 1)", tree.getKeyValuePairForLongestKeyPrefixing("COD").toString()); assertEquals("(CODFISH, 2)", tree.getKeyValuePairForLongestKeyPrefixing("CODFISH").toString()); assertEquals("(CODFISHES, 4)", tree.getKeyValuePairForLongestKeyPrefixing("CODFISHES").toString()); assertEquals("(COD, 1)", tree.getKeyValuePairForLongestKeyPrefixing("CODFUNKY").toString()); assertEquals("(CODFISH, 2)", tree.getKeyValuePairForLongestKeyPrefixing("CODFISHING").toString()); assertNull(tree.getKeyValuePairForLongestKeyPrefixing("DOESNOTEXIST")); assertNull(tree.getKeyValuePairForLongestKeyPrefixing("C")); assertNull(tree.getKeyValuePairForLongestKeyPrefixing("CO")); assertNull(tree.getKeyValuePairForLongestKeyPrefixing("")); }
@Override public KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document) { return radixTree.scanForLongestKeyAtStartOfInput(document); }
ConcurrentInvertedRadixTree implements InvertedRadixTree<O>, PrettyPrintable, Serializable { @Override public KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document) { return radixTree.scanForLongestKeyAtStartOfInput(document); } }
ConcurrentInvertedRadixTree implements InvertedRadixTree<O>, PrettyPrintable, Serializable { @Override public KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document) { return radixTree.scanForLongestKeyAtStartOfInput(document); } ConcurrentInvertedRadixTree(NodeFactory nodeFactory); }
ConcurrentInvertedRadixTree implements InvertedRadixTree<O>, PrettyPrintable, Serializable { @Override public KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document) { return radixTree.scanForLongestKeyAtStartOfInput(document); } ConcurrentInvertedRadixTree(NodeFactory nodeFactory); @Override O put(CharSequence key, O value); @Override O putIfAbsent(CharSequence key, O value); @Override boolean remove(CharSequence key); @Override O getValueForExactKey(CharSequence key); @Override Iterable<CharSequence> getKeysStartingWith(CharSequence prefix); @Override Iterable<O> getValuesForKeysStartingWith(CharSequence prefix); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysStartingWith(CharSequence prefix); @Override Iterable<CharSequence> getClosestKeys(CharSequence candidate); @Override Iterable<O> getValuesForClosestKeys(CharSequence candidate); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForClosestKeys(CharSequence candidate); @Override Iterable<CharSequence> getKeysPrefixing(final CharSequence document); @Override Iterable<O> getValuesForKeysPrefixing(final CharSequence document); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysPrefixing(final CharSequence document); @Override CharSequence getLongestKeyPrefixing(CharSequence document); @Override O getValueForLongestKeyPrefixing(CharSequence document); @Override KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document); @Override Iterable<CharSequence> getKeysContainedIn(final CharSequence document); @Override Iterable<O> getValuesForKeysContainedIn(final CharSequence document); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysContainedIn(final CharSequence document); @Override int size(); @Override Node getNode(); }
ConcurrentInvertedRadixTree implements InvertedRadixTree<O>, PrettyPrintable, Serializable { @Override public KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document) { return radixTree.scanForLongestKeyAtStartOfInput(document); } ConcurrentInvertedRadixTree(NodeFactory nodeFactory); @Override O put(CharSequence key, O value); @Override O putIfAbsent(CharSequence key, O value); @Override boolean remove(CharSequence key); @Override O getValueForExactKey(CharSequence key); @Override Iterable<CharSequence> getKeysStartingWith(CharSequence prefix); @Override Iterable<O> getValuesForKeysStartingWith(CharSequence prefix); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysStartingWith(CharSequence prefix); @Override Iterable<CharSequence> getClosestKeys(CharSequence candidate); @Override Iterable<O> getValuesForClosestKeys(CharSequence candidate); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForClosestKeys(CharSequence candidate); @Override Iterable<CharSequence> getKeysPrefixing(final CharSequence document); @Override Iterable<O> getValuesForKeysPrefixing(final CharSequence document); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysPrefixing(final CharSequence document); @Override CharSequence getLongestKeyPrefixing(CharSequence document); @Override O getValueForLongestKeyPrefixing(CharSequence document); @Override KeyValuePair<O> getKeyValuePairForLongestKeyPrefixing(CharSequence document); @Override Iterable<CharSequence> getKeysContainedIn(final CharSequence document); @Override Iterable<O> getValuesForKeysContainedIn(final CharSequence document); @Override Iterable<KeyValuePair<O>> getKeyValuePairsForKeysContainedIn(final CharSequence document); @Override int size(); @Override Node getNode();  }