Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BitArray

Bit array

Based heavily on https://github.com/lemire/FastBitSet.js which is licensed under the Apache License, Version 2.0.

Hierarchy

  • BitArray

Index

Constructors

constructor

  • new BitArray(length: number, setAll?: undefined | false | true): BitArray

Properties

Private _words

_words: Uint32Array

length

length: number

Methods

_assignRange

  • _assignRange(start: number, end: number, value: boolean): undefined | this

_isRangeValue

  • _isRangeValue(start: number, end: number, value: boolean): undefined | false | true

clear

  • clear(index: number): void

clearAll

  • clearAll(): undefined | this

clearBits

  • clearBits(...indices: number[]): this
  • Clear bits at all given indices

    Parameters

    • Rest ...indices: number[]

    Returns this

    this object

clearRange

  • clearRange(start: number, end: number): undefined | this
  • Clear bits of the given range

    Parameters

    • start: number

      start index

    • end: number

      end index

    Returns undefined | this

    this object

clone

  • clone(): any

difference

  • difference(otherBitarray: BitArray): this
  • Calculate difference betwen this and another bit array. Store result in this object.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns this

    this object

flip

  • flip(index: number): void

flipAll

  • flipAll(): this

forEach

  • forEach(callback: (index: number, i: number) => any): void
  • Iterate over all set bits in the array

    Parameters

    • callback: (index: number, i: number) => any

      the callback

        • (index: number, i: number): any
        • Parameters

          • index: number
          • i: number

          Returns any

    Returns void

get

  • get(index: number): boolean

getIntersectionSize

  • getIntersectionSize(otherBitarray: BitArray): number
  • Calculate the number of bits in common betwen this and another bit array.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns number

    size

getSize

  • getSize(): number

intersection

  • intersection(otherBitarray: BitArray): this
  • Calculate intersection betwen this and another bit array. Store result in this object.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns this

    this object

intersects

  • intersects(otherBitarray: BitArray): boolean
  • Test if there is any intersection betwen this and another bit array.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns boolean

    test result

isAllClear

  • isAllClear(): undefined | false | true

isAllSet

  • isAllSet(): undefined | false | true

isClear

  • isClear(...indices: number[]): boolean
  • Test if bits at all given indices are clear

    Parameters

    • Rest ...indices: number[]

    Returns boolean

    test result

isEqualTo

  • isEqualTo(otherBitarray: BitArray): boolean
  • Test if two BitArrays are identical in all their values

    Parameters

    • otherBitarray: BitArray

      the other BitArray

    Returns boolean

    test result

isRangeClear

  • isRangeClear(start: number, end: number): undefined | false | true
  • Test if bits in given range are clear

    Parameters

    • start: number

      start index

    • end: number

      end index

    Returns undefined | false | true

    this object

isRangeSet

  • isRangeSet(start: number, end: number): undefined | false | true
  • Test if bits in given range are set

    Parameters

    • start: number

      start index

    • end: number

      end index

    Returns undefined | false | true

    this object

isSet

  • isSet(...indices: number[]): boolean
  • Test if bits at all given indices are set

    Parameters

    • Rest ...indices: number[]

    Returns boolean

    test result

makeIntersection

  • makeIntersection(otherBitarray: BitArray): any
  • Calculate intersection betwen this and another bit array. Store result in a new bit array.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns any

    the new bit array

set

  • set(index: number): void

setAll

  • setAll(): undefined | this

setBits

  • setBits(...indices: number[]): this
  • Set bits at all given indices

    Parameters

    • Rest ...indices: number[]

    Returns this

    this object

setRange

  • setRange(start: number, end: number): undefined | this
  • Set bits of the given range

    Parameters

    • start: number

      start index

    • end: number

      end index

    Returns undefined | this

    this object

toArray

  • toArray(): any[]

toSeleString

  • toSeleString(): string

toString

  • toString(): string

union

  • Calculate union betwen this and another bit array. Store result in this object.

    Parameters

    • otherBitarray: BitArray

      the other bit array

    Returns this

    this object

Generated using TypeDoc