Class HuffmanParamsCalculator<T>

java.lang.Object
htsjdk.samtools.cram.encoding.core.huffmanUtils.HuffmanParamsCalculator<T>
Type Parameters:
T - type of the symbols in the alphabet being huffman-encoded

public class HuffmanParamsCalculator<T> extends Object
A utility class that calculates Huffman encoding parameters based on the frequencies of the symbols to be encoded. Note this does not generate the actual (canonical) huffman codes, it only generates non-canonical codes as intermediate step in order to determine the huffman bit code lengths, which are part of the encoding params.
  • Constructor Details

    • HuffmanParamsCalculator

      public HuffmanParamsCalculator()
  • Method Details

    • addSymbolObservations

      public void addSymbolObservations(T symbol, int numberOfObservations)
      Record one or more observations of a given symbol in the input stream.
      Parameters:
      symbol - symbol observed
      numberOfObservations - number of observations
    • getHuffmanParams

      public HuffmanParams<T> getHuffmanParams()
      Returns:
      the HuffmanParams for the given alphabet