goldman.collection.ordered.digitized
Class AbstractTrieNode<E>

java.lang.Object
  extended by goldman.collection.ordered.digitized.AbstractTrieNode<E>
All Implemented Interfaces:
TrieNode<E>
Direct Known Subclasses:
AbstractTrieLeafNode, Trie.InternalNode

public abstract class AbstractTrieNode<E>
extends Object
implements TrieNode<E>

The AbstractTrieNode class implements methods that can be shared by all implementations of a trie node.


Constructor Summary
AbstractTrieNode()
           
 
Method Summary
 TrieNode<E> child(int i)
          Returns a reference to the ith child.
 E data()
          Returns the data (if any) associated with this trie node.
 boolean isLeaf()
          Returns true if and only if this trie node is a leaf.
 TrieNode<E> parent()
          Returns a reference to the parent (or null for the root).
 void setParent(TrieNode<E> parent)
          Sets the parent reference to be the given trie node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTrieNode

public AbstractTrieNode()
Method Detail

isLeaf

public boolean isLeaf()
Description copied from interface: TrieNode
Returns true if and only if this trie node is a leaf.

Specified by:
isLeaf in interface TrieNode<E>
Returns:
false

parent

public TrieNode<E> parent()
Description copied from interface: TrieNode
Returns a reference to the parent (or null for the root).

Specified by:
parent in interface TrieNode<E>
Returns:
a reference to the parent trie node

setParent

public void setParent(TrieNode<E> parent)
Description copied from interface: TrieNode
Sets the parent reference to be the given trie node.

Specified by:
setParent in interface TrieNode<E>
Parameters:
parent - a reference to the new parent reference

child

public TrieNode<E> child(int i)
Description copied from interface: TrieNode
Returns a reference to the ith child.

Specified by:
child in interface TrieNode<E>
Parameters:
i - the index for the desired child

data

public E data()
Description copied from interface: TrieNode
Returns the data (if any) associated with this trie node. All data elements are held in leaf nodes, but for some trie implementations the internal nodes hold a reference to an element that begins with the common prefix shared by all of its descendants.

Specified by:
data in interface TrieNode<E>
Returns:
the data (if any) associated with the trie node.