goldman.collection.ordered.digitized
Class Trie.InternalNode

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

protected class Trie.InternalNode
extends AbstractTrieNode<E>
implements TrieNode<E>


Method Summary
 TrieNode<E> child(int i)
          Returns a reference to the ith child.
 int childIndex(E element, int bp)
           
protected  int setChild(TrieNode<E> child, E element, int bp)
          Sets the associated child for element to child.
 
Methods inherited from class goldman.collection.ordered.digitized.AbstractTrieNode
data, isLeaf, parent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface goldman.collection.ordered.digitized.TrieNode
data, isLeaf, parent, setParent
 

Method Detail

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>
Overrides:
child in class AbstractTrieNode<E>
Parameters:
i - the index for the desired child
Returns:
the ith child
Throws:
IllegalArgumentException - i is not between 0 and childCapacity -1 (inclusive).

childIndex

public int childIndex(E element,
                      int bp)
Parameters:
element - the element for which the index of the child is sought
bp - the branch position of the node on which this method is called
Returns:
the index for the next node on the search path defined by element.

setChild

protected int setChild(TrieNode<E> child,
                       E element,
                       int bp)
Sets the associated child for element to child.

Parameters:
child - the new child to add
element - the element defining the search path for the child
bp - the branch position of the node on which this method is called
REQUIRES: child is not null.
Returns:
the index at which child is placed