Class 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.
    • 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.
    • 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.
      • 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.