ptolemy.actor.lib.comm
Class HuffmanBasic.Node

java.lang.Object
  extended by 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
 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
HuffmanBasic.Node(double prob, int index)
          Construct the node with the given probability value and its index in the pmf array.
HuffmanBasic.Node(HuffmanBasic.Node left, HuffmanBasic.Node right)
          Construct the parent node given the left child and the right child.
 
Method Summary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

HuffmanBasic.Node

public HuffmanBasic.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.

HuffmanBasic.Node

public HuffmanBasic.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.