flatFileToBinaryPackage.HuffMan
Class Huffman

java.lang.Object
  extended by flatFileToBinaryPackage.HuffMan.Huffman

public class Huffman
extends java.lang.Object

Class: Huffman Displays live Huffman compression/decompression of strings. The current string, either compressed or decompressed, is stored in _workString. When the user clicks on the applet, the data is compressed and the progress of the compression is displayed. Clicking again will decompress the data. The user may compress/decompress to their heart's content (or until their mouse button wears out.) Assumptions for code simplicity: - Alphabet used in input strings consists of all visible characters only. - Chars are 1 byte (8-bits), even though Java really uses Unicode (2-byte) chars. Shame on us! Huffman compression code is based on the code in R. Sedgewick's _Algorithms in C++_. slightly modified by Dominik Szopa


Field Summary
 double[] PMF
           
 
Constructor Summary
Huffman()
           
Huffman(double[] PMF)
           
 
Method Summary
 java.lang.String charCode(int index)
          charCode Returns a string containing the (compressed) bit representation of the specified character in our alphabet.
static void main(java.lang.String[] args)
           
 void reinitializePMF(double[] PMF)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PMF

public double[] PMF
Constructor Detail

Huffman

public Huffman(double[] PMF)
Parameters:
PMF -

Huffman

public Huffman()
Method Detail

reinitializePMF

public void reinitializePMF(double[] PMF)

charCode

public java.lang.String charCode(int index)
                          throws java.lang.IndexOutOfBoundsException
charCode Returns a string containing the (compressed) bit representation of the specified character in our alphabet.

Throws:
java.lang.IndexOutOfBoundsException

main

public static void main(java.lang.String[] args)