org.rutil.collection.trie
Class TrieNode<VALUE_TYPE>
java.lang.Object
org.rutil.collection.SingleLinkedEntry.DefaultSingleLinkedEntry<VALUE_TYPE>
org.rutil.collection.trie.TrieNode<VALUE_TYPE>
- All Implemented Interfaces:
- SingleLinkedEntry<VALUE_TYPE>
public class TrieNode<VALUE_TYPE>
- extends SingleLinkedEntry.DefaultSingleLinkedEntry<VALUE_TYPE>
A node object that can be used to build a tree of nodes. A node is organized as a node (itself)
with other nodes as branches (optional). A key and (optionally) one or more value can be associated
with each node.
- Author:
- mohan
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TrieNode
public TrieNode()
add
public TrieNode<VALUE_TYPE> add(java.lang.String key,
VALUE_TYPE value)
addKey
protected TrieNode<VALUE_TYPE> addKey(java.lang.String key,
int index)
areAllCharsPartOfKey
protected boolean areAllCharsPartOfKey(java.lang.String key,
int index)
findNode
public TrieNode<VALUE_TYPE> findNode(char c)
addNewNode
protected TrieNode<VALUE_TYPE> addNewNode(java.lang.String key,
int index)
getNodes
public java.util.Iterator<TrieNode<VALUE_TYPE>> getNodes()
hasChildNodes
public boolean hasChildNodes()
addChars
protected void addChars(java.lang.String key,
int startIndex)
addNode
public void addNode(TrieNode<VALUE_TYPE> node)
addValue
protected void addValue(VALUE_TYPE value)
hasValues
public boolean hasValues()
getValues
public java.util.Iterator<VALUE_TYPE> getValues()
getChars
public CharArrayList getChars()
isEmpty
protected boolean isEmpty()
getLastMatchingCharIndex
public int getLastMatchingCharIndex(java.lang.String key,
int startIndex)
branch
public TrieNode<VALUE_TYPE> branch(int branchFrom)
startsWithChar
public boolean startsWithChar(char c)
getFirstChar
public char getFirstChar()
remove
public SingleLinkedList<VALUE_TYPE> remove(java.lang.String key)