Package ptolemy.actor.lib.comm
Class HuffmanBasic.Node
- java.lang.Object
-
- ptolemy.actor.lib.comm.HuffmanBasic.Node
-
- Enclosing class:
- HuffmanBasic
public static class HuffmanBasic.Node extends java.lang.Object
A class that defines the node in binary tree that is used to construct the codebook of Huffman code.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
huffmanCode
The huffman code of this node.int
indexInArray
The corresponding index in the pmf array of this node.HuffmanBasic.Node
leftChild
The left child of the node.double
probability
The probability of the node.HuffmanBasic.Node
rightChild
The right child of the node.
-
Constructor Summary
Constructors Constructor Description Node(double prob, int index)
Construct the node with the given probability value and its index in the pmf array.Node(HuffmanBasic.Node left, HuffmanBasic.Node right)
Construct the parent node given the left child and the right child.
-
-
-
Field Detail
-
probability
public double probability
The probability of the node.
-
indexInArray
public int indexInArray
The corresponding index in the pmf array of this node. If the value is -1, then this node is constructed by combining at least two probabilities.
-
leftChild
public HuffmanBasic.Node leftChild
The left child of the node.
-
rightChild
public HuffmanBasic.Node rightChild
The right child of the node.
-
huffmanCode
public java.lang.String huffmanCode
The huffman code of this node.
-
-
Constructor Detail
-
Node
public Node(double prob, int index)
Construct the node with the given probability value and its index in the pmf array.- Parameters:
prob
- The given probability value.index
- The corresponding index in the pmf array.
-
Node
public Node(HuffmanBasic.Node left, HuffmanBasic.Node right)
Construct the parent node given the left child and the right child.- Parameters:
left
- The left child.right
- The right child.
-
-