|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface TrieWriter
The TrieWriter interface provides a means
to write an arbitrary trie structure with positive node counts.
A trie is encoded depth-first according to the following
recursive definition. First, the the count of the tree
(count) is encoded. Then, for each daughter
K, 1 <= K <= N, in
increasing symbol order, the daughter symbol (dtrSymK)
is encoded followed by the encoding of the daughter tree
(dtrTreeK). Finally, after the last daughter tree is
encoded, the number -1 is encoded.
encode(tree) = count dtrSym1 encode(dtrTree1) ... dtrSymN encode(dtrTreeN) -1
This results in a unique depth-first encoding of an entire tree
as a sequence of long values.
| Method Summary | |
|---|---|
void |
writeCount(long count)
Writes the specified count for the next sub-trie. |
void |
writeSymbol(long symbol)
Writes the specified symbol for the next daughter. |
| Method Detail |
|---|
void writeCount(long count)
throws IOException
count - Count to write.
IOException - If there is an underlying I/O error.
IllegalStateException - If it is not legal to write a count
into the current sequence.
void writeSymbol(long symbol)
throws IOException
The symbol -1 must be written following the last
daughter of a tree.
symbol - Symbol to write.
IOException - If there is an underlying I/O error.
IllegalStateException - If it is not legal to write a
symbol into the current sequence.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||