# Class RANSDecodingSymbol

java.lang.Object
htsjdk.samtools.cram.compression.rans.RANSDecodingSymbol

public final class RANSDecodingSymbol extends Object
Holds the start and frequency for a single symbol in the rANS decoding table. The reverse-lookup table mapping cumulative frequency to symbol is held separately in the decoder's `reverseLookup` arrays.

Decoding a symbol is a two-step process:

1. `advanceSymbolStep(long, int)` — updates the rANS state using the symbol's range
2. `Utils.RANSDecodeRenormalizeNx16(long, byte[], int[])` or `Utils.RANSDecodeRenormalize4x8(long, byte[], int[])` — renormalizes by reading bytes from the compressed stream

## Constructor Summary

Constructors
Constructor
Description
`RANSDecodingSymbol()`

## Method Summary

Modifier and Type
Method
Description
`long`
`advanceSymbolStep(long r, int scaleBits)`
Advance the rANS state by one decoded symbol.
`void`
`set(int start, int freq)`
Set the decoding parameters for this symbol.

### Methods inherited from class Object

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

## Constructor Details

### RANSDecodingSymbol

public RANSDecodingSymbol()

## Method Details

### set

public void set(int start, int freq)
Set the decoding parameters for this symbol.

Parameters:
  `start` - the cumulative frequency of all preceding symbols
  `freq` - the frequency of this symbol

### advanceSymbolStep

public long advanceSymbolStep(long r, int scaleBits)
Advance the rANS state by one decoded symbol. Does not renormalize — the caller must call the appropriate `Utils.RANSDecodeRenormalize*` method after this.

Parameters:
  `r` - the current rANS state
  `scaleBits` - the frequency scale (log2 of total frequency sum)
Returns:
  the updated rANS state (before renormalization)