Home Reference Source
import {RunLengthEncoding} from 'rabbit-hole'
public class | source

RunLengthEncoding

Run-Length Encoding for numerical data.

Static Method Summary

Static Public Methods
public static

decode(runLengths: Number[], data: Number[], array: Array): Array

Decodes the given data.

public static

Encodes the given data.

Constructor Summary

Public Constructor
public

constructor(runLengths: Number[], data: Number[])

Constructs a new container for Run-Length encoded data.

Member Summary

Public Members
public

The encoded data.

public

The run lengths.

Static Public Methods

public static decode(runLengths: Number[], data: Number[], array: Array): Array source

Decodes the given data.

Params:

NameTypeAttributeDescription
runLengths Number[]

The run-lengths.

data Number[]

The data to decode.

array Array
  • optional

An optional target.

Return:

Array

The decoded data.

public static encode(array: Number[]): RunLengthEncoding source

Encodes the given data.

Params:

NameTypeAttributeDescription
array Number[]

The data to encode.

Return:

RunLengthEncoding

The run-lengths and the encoded data.

Public Constructors

public constructor(runLengths: Number[], data: Number[]) source

Constructs a new container for Run-Length encoded data.

Params:

NameTypeAttributeDescription
runLengths Number[]
  • optional
  • default: null

The run lengths.

data Number[]
  • optional
  • default: null

The encoded data.

Public Members

public data: Number[] source

The encoded data.

public runLengths: Number[] source

The run lengths.