com.pixelmed.scpecg

## Class HuffmanTable

- java.lang.Object
- - com.pixelmed.scpecg.HuffmanTable

- Direct Known Subclasses:
    DefaultHuffmanTable

      public class HuffmanTable
      extends java.lang.Object

  A class to store Huffman Tables, either as read from an SCP-ECG file or the default as specified in the SCP-ECG standard.

  See Also:
    `DefaultHuffmanTable`, `HuffmanDecoder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected long[]` | `baseCode`
    `protected int[]` | `baseValueRepresentedByBaseCode`
    `protected int[]` | `numberOfBitsInEntireCode`
    `protected int[]` | `numberOfBitsInPrefix`
    `protected int` | `numberOfCodeStructuresInTable`
    `protected int[]` | `tableModeSwitch`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `HuffmanTable()`
    `` | `HuffmanTable(int numberOfCodeStructuresInTable, int[] numberOfBitsInPrefix, int[] numberOfBitsInEntireCode, int[] tableModeSwitch, int[] baseValueRepresentedByBaseCode, long[] baseCode)` Construct a Huffman Table from the supplied data as read from an SCP-ECG file.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long[]` | `getBaseCode()`
    `int[]` | `getBaseValueRepresentedByBaseCode()`
    `int[]` | `getNumberOfBitsInEntireCode()`
    `int[]` | `getNumberOfBitsInPrefix()`
    `int` | `getNumberOfCodeStructuresInTable()`
    `int[]` | `getTableModeSwitch()`
    `java.lang.String` | `toString()` Dump the tables as a `String`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### numberOfCodeStructuresInTable

          protected int numberOfCodeStructuresInTable

    - #### numberOfBitsInPrefix

          protected int[] numberOfBitsInPrefix

    - #### numberOfBitsInEntireCode

          protected int[] numberOfBitsInEntireCode

    - #### tableModeSwitch

          protected int[] tableModeSwitch

    - #### baseValueRepresentedByBaseCode

          protected int[] baseValueRepresentedByBaseCode

    - #### baseCode

          protected long[] baseCode

  - ### Constructor Detail

    - #### HuffmanTable

          protected HuffmanTable()

    - #### HuffmanTable

          public HuffmanTable(int numberOfCodeStructuresInTable,
                              int[] numberOfBitsInPrefix,
                              int[] numberOfBitsInEntireCode,
                              int[] tableModeSwitch,
                              int[] baseValueRepresentedByBaseCode,
                              long[] baseCode)

      Construct a Huffman Table from the supplied data as read from an SCP-ECG file.

      Parameters:
        `numberOfCodeStructuresInTable` - the number of codes (i.e. the size of all the array parameters)
        `numberOfBitsInPrefix` - for each code, the number of prefix bits for each code (i.e. the Huffman code)
        `numberOfBitsInEntireCode` - for each code, if > numberOfBitsInPrefix, used to find the number of original bits encoded
        `tableModeSwitch` - for each code, a flag to indicate to switch to another table (1 indicates no switch)
        `baseValueRepresentedByBaseCode` - for each code, the value that the code represents
        `baseCode` - the codes (with the order of bits reversed)

  - ### Method Detail

    - #### getNumberOfCodeStructuresInTable

          public int getNumberOfCodeStructuresInTable()

    - #### getNumberOfBitsInPrefix

          public int[] getNumberOfBitsInPrefix()

    - #### getNumberOfBitsInEntireCode

          public int[] getNumberOfBitsInEntireCode()

    - #### getTableModeSwitch

          public int[] getTableModeSwitch()

    - #### getBaseValueRepresentedByBaseCode

          public int[] getBaseValueRepresentedByBaseCode()

    - #### getBaseCode

          public long[] getBaseCode()

    - #### toString

          public java.lang.String toString()

      Dump the tables as a `String`.

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the tables as a `String`