com.planet_ink.coffee_mud.core.collections
Class KeyPairWildSearchTree<V>

java.lang.Object
  extended by com.planet_ink.coffee_mud.core.collections.KeyPairSearchTree<V>
      extended by com.planet_ink.coffee_mud.core.collections.KeyPairWildSearchTree<V>

public class KeyPairWildSearchTree<V>
extends KeyPairSearchTree<V>

A quick prefix lookup tree that takes a lot of memory, but is worth it in speed. It stores key/pairs, and can be asked if a string starts with one of the keys. If it does, it returns the value of the pair. This version supports wildcard characters ? and *.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.planet_ink.coffee_mud.core.collections.KeyPairSearchTree
KeyPairSearchTree.KeyPairNode<K,T>
 
Field Summary
 
Fields inherited from class com.planet_ink.coffee_mud.core.collections.KeyPairSearchTree
root
 
Constructor Summary
KeyPairWildSearchTree()
           
 
Method Summary
 Pair<java.lang.String,V> findLongestValue(java.lang.String fullStr)
          Retrieve the value for the longest key that the given string starts with
protected  Pair<java.lang.String,V> findLongestValueWithWildcards(java.lang.String fullStr, KeyPairSearchTree.KeyPairNode<java.lang.String,V> startNode, int[] index)
          Retrieve the value for the longest key that the given string starts with, with wildcard support
 
Methods inherited from class com.planet_ink.coffee_mud.core.collections.KeyPairSearchTree
addEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyPairWildSearchTree

public KeyPairWildSearchTree()
Method Detail

findLongestValueWithWildcards

protected Pair<java.lang.String,V> findLongestValueWithWildcards(java.lang.String fullStr,
                                                                 KeyPairSearchTree.KeyPairNode<java.lang.String,V> startNode,
                                                                 int[] index)
Retrieve the value for the longest key that the given string starts with, with wildcard support

Parameters:
fullStr - the string that might start with a key
startNode - the search node to start with
index - the index into the string to start with, and ends with
Returns:
the value

findLongestValue

public Pair<java.lang.String,V> findLongestValue(java.lang.String fullStr)
Retrieve the value for the longest key that the given string starts with

Overrides:
findLongestValue in class KeyPairSearchTree<V>
Parameters:
fullStr - the string that might start with a key
Returns:
the value