au.id.pbw.hyfo.hyph
Interface TernaryTree

All Known Implementing Classes:
BigTernaryTree, ShortTernaryTree

public interface TernaryTree

Interface describing ternary trees.

Author:
pbw

Method Summary
 Subsearch find_next(int[] key, int index, int node_num)
          Returns a Subsearch representing the psotion in the tree of the next non-null data discovered in traversing the given key.
 int find(int[] key)
          Finds the node corresponding to the given key.
 int get_equal_node(int node)
          Gets the node number from the equal link of the given node.
 String get_key(List<Integer> stack)
          Derive a string from the list of codepoints representing the key.
 int get_node_data_ptr(int node)
          Get the data pointer value from the nominated node.
 void initialize_data_array()
          When all the data for the tree has been added, initialize the tree data to minimize space requirements.
 Iterator iterator()
          Gets an in-order iterator over the tree.
 

Method Detail

get_node_data_ptr

int get_node_data_ptr(int node)
Get the data pointer value from the nominated node.

Parameters:
node - the node.
Returns:
the data pointer value from the node.

find

int find(int[] key)
Finds the node corresponding to the given key.

Parameters:
key - the key as an array of codepoints.
Returns:
the node number corresponding to the key, or 0.

initialize_data_array

void initialize_data_array()
                           throws HyphenationException
When all the data for the tree has been added, initialize the tree data to minimize space requirements.

Throws:
HyphenationException - if the tree data has already been initialized.

get_key

String get_key(List<Integer> stack)
Derive a string from the list of codepoints representing the key.

Parameters:
stack - the list of codepoints representing the key.
Returns:
the key as a string.

get_equal_node

int get_equal_node(int node)
Gets the node number from the equal link of the given node.

Parameters:
node - the node whoe equal link is required.
Returns:
the equal link or 0.

find_next

Subsearch find_next(int[] key,
                    int index,
                    int node_num)
Returns a Subsearch representing the psotion in the tree of the next non-null data discovered in traversing the given key.

This method allows successive matches on a key to be discovered in order.

Parameters:
key - the key as an array of codepoints.
index - the current index position in the key.
node_num - the current node number. The equal pointer of this node will be the resumption point of the search.
Returns:
the next Subsearch for the given key, or null.

iterator

Iterator iterator()
Gets an in-order iterator over the tree.

Returns:
the in-order iterator.


Copyright © 2005-2006 Peter B. West.