Class HuffmanParams<T>

  • Type Parameters:
    T - type of the symbols in the alphabet being huffman-encoded

    public final class HuffmanParams<T>
    extends Object
    A class for carrying around encoding parameters for a canonical Huffman encoder. The HuffmanParams consist of an array of symbols and an array of corresponding codeWordLengths. The actual codewords themselves are not part of the params since they can be recalculated on demand. Therefore, the params are independent of the canonicalization state (the "canonical" huffman params are the same as the non-canonical params for a given set of symbol/frequencies; it is only the code words themselves are different after canonicalization; the code word lengths are the preserved).
    • Constructor Detail

      • HuffmanParams

        public HuffmanParams​(List<T> symbols,
                             List<Integer> codeWordLengths)
        Parameters:
        symbols - symbols being encoded
        codeWordLengths - code word lengths for each symbol
    • Method Detail

      • getSymbols

        public List<T> getSymbols()
        Returns:
        the list of symbols for these params
      • getCodeWordLengths

        public List<Integer> getCodeWordLengths()
        Returns:
        the list of code word bit lengths for these params
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object