| Modifier and Type | Field and Description |
|---|---|
| private static final int | NODE
Value in the array indicating a non leaf node |
| private final int[] | tree
The array representing the binary tree. |
| private static final int | UNDEFINED
Value in the array indicating an undefined node |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | addLeaf(final int
the index of the node where the path is appended node, final int the path to the leaf (bits are parsed from the right to the left) path, final int the number of nodes in the path depth, final int the value of the leaf (must be positive) value)Adds a leaf to the tree. |
| pack-priv static BinaryTree | decode(final InputStream inputStream, final int totalNumberOfValues)
Decodes the packed binary tree from the specified stream. |
| public int |
| NODE | back to summary |
|---|---|
| private static final int NODE Value in the array indicating a non leaf node | |
| tree | back to summary |
|---|---|
| private final int[] tree The array representing the binary tree. The root is at index 0, the left children are at 2*i+1 and the right children at 2*i+2. | |
| UNDEFINED | back to summary |
|---|---|
| private static final int UNDEFINED Value in the array indicating an undefined node | |
| BinaryTree | back to summary |
|---|---|
| pack-priv BinaryTree(final int depth) | |
| addLeaf | back to summary |
|---|---|
| public void addLeaf(final int node, final int path, final int depth, final int value) Adds a leaf to the tree.
| |
| decode | back to summary |
|---|---|
| pack-priv static BinaryTree decode(final InputStream inputStream, final int totalNumberOfValues) throws IOException Decodes the packed binary tree from the specified stream. | |
| read | back to summary |
|---|---|
| public int read(final BitStream stream) throws IOException Reads a value from the specified bit stream.
| |