Package com.pixelmed.scpecg

# Class HuffmanTable

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

Direct Known Subclasses:
  `DefaultHuffmanTable`

public class HuffmanTable extends 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
Description
`protected long[]`
`baseCode`
`protected int[]`
`baseValueRepresentedByBaseCode`
`protected int[]`
`numberOfBitsInEntireCode`
`protected int[]`
`numberOfBitsInPrefix`
`protected int`
`numberOfCodeStructuresInTable`
`protected int[]`
`tableModeSwitch`

## Constructor Summary

Constructors
Modifier
Constructor
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

Modifier and Type
Method
Description
`long[]`
`getBaseCode()`
`int[]`
`getBaseValueRepresentedByBaseCode()`
`int[]`
`getNumberOfBitsInEntireCode()`
`int[]`
`getNumberOfBitsInPrefix()`
`int`
`getNumberOfCodeStructuresInTable()`
`int[]`
`getTableModeSwitch()`
`String`
`toString()`
Dump the tables as a `String`.

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

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

## Field Details

### 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 Details

### 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 Details

### 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 String toString()

Dump the tables as a `String`.

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