|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object au.id.pbw.hyfo.hyph.BigTernaryTree
public class BigTernaryTree
A TernaryTree
whose node count may exceed Short.MAX_VALUE.
Nested Class Summary | |
---|---|
class |
BigTernaryTree.TernaryIterator
Defines an in-order Iterator over the tree. |
class |
BigTernaryTree.TernaryTreeWalker
This process walks the tree and feeds TreeElement s into a
blocking queue for reading by an Iterator . |
Constructor Summary | |
---|---|
BigTernaryTree(TernaryTreeDataStore data_store)
Creates a new instance of BigTernaryTree |
Method Summary | |
---|---|
void |
add(int[] key,
int index,
int data,
int node_num)
Inserts the subkey represented by the array of Unicode codepoints and associated data. |
Subsearch |
find_next(int[] key,
int index,
int node_num)
Returns a Subsearch representing a position in the tree at which
non-null DATA was found while tracing a given key. |
int |
find(int[] key)
Find the data pointer associated with a given key, or 0 if the key does not occur . |
int |
get_equal_node(int node)
Gets the node pointed to by the equal pointer of the given node. |
String |
get_key(List<Integer> stack)
Constructs the key from the series of entries in the key codepoint stack. |
int |
get_node_data_ptr(int node)
Gets the node data. |
void |
initialize_data_array()
Finalizes the data initialization of this BigTernaryTree . |
void |
insert_mid(String[] keys,
Map<String,Integer> map,
int lo,
int hi)
Given a ascending sorted array of keys , a map
associating a datum with each key, the index of the least key to be
inserted (lo ) and the index of the greatest key to be inserted
(hi ), perform a balanced add of all of the keys between the
least and the greatest, inclusive. |
BigTernaryTree.TernaryIterator |
iterator()
Gets a TernaryIterator for in-order traversal of the tree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BigTernaryTree(TernaryTreeDataStore data_store)
data_store
- an implementation of TernaryTreeDataStore
.Method Detail |
---|
public int get_node_data_ptr(int node)
get_node_data_ptr
in interface TernaryTree
node
- the number of the data node.
public int find(int[] key)
find
in interface TernaryTree
key
- the key, as an array of Unicode codepoints.
DATA
or null
.public Subsearch find_next(int[] key, int index, int node_num)
Subsearch
representing a position in the tree at which
non-null DATA
was found while tracing a given key. This is a
match of a prefix of the search key. The returned Subsearch
can
subsequently be used to find the next longer prefix of the key with
associated DATA
.
find_next
in interface TernaryTree
key
- the key of which prefixes are being sought.index
- the next Unicode character of the search string. A prefix
equal to or longer than this position of the key will be the next found,
if one exists.node_num
- the node number at which the search commences.
Subsearch
representing the next located prefix of the
key, or null
.public void add(int[] key, int index, int data, int node_num) throws HyphenationException
key
- the Unicode codepoints of the subkey.index
- the index within the key
array fo the beginning of
the add text.data
- the data associated with the key.node_num
- the node number at which the insertion is occuring.
HyphenationException
- if an invalid node number
argument is passed.public void insert_mid(String[] keys, Map<String,Integer> map, int lo, int hi) throws HyphenationException
keys
, a map
associating a datum with each key, the index of the least key to be
inserted (lo
) and the index of the greatest key to be inserted
(hi
), perform a balanced add of all of the keys between the
least and the greatest, inclusive.
The datum for a key is an Integer
, whose interpretation is left
to the TernaryTreeDataStore
implementation.
keys
- the array of all keys.map
- the Map
associating data with keys.lo
- the least key to be inserted from the array.hi
- the greatest key to be inserted from the array.
HyphenationException
- if the tree has already
been initialized, indicating that tree building is finalized.public void initialize_data_array() throws HyphenationException
BigTernaryTree
. This assumes that
all required nodes have been added to the tree. The parallel arrays representing the
node links (equal
, less
, greater
, parent
and the
pointer to the node data are all reset to their minimum size.
initialize_data_array
in interface TernaryTree
HyphenationException
- if the tree has already
been initialized, indicating that tree building is finalized.public String get_key(List<Integer> stack)
get_key
in interface TernaryTree
stack
- the stack of Integer
s containing the codepoints
of the key.
String
.public BigTernaryTree.TernaryIterator iterator()
TernaryIterator
for in-order traversal of the tree.
iterator
in interface TernaryTree
TernaryIterator
for in-order traversal of the tree.public int get_equal_node(int node)
get_equal_node
in interface TernaryTree
node
- the node whose equal pointer is returned.
node
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |