Class BitMask<T>

Bit Masker utility class.

Type Parameters

  • T

Hierarchy

  • BitMask

Constructors

  • Type Parameters

    • T

    Parameters

    • value: number = 0

      The current value of the bit mask, defaults to 0

    • bits: T[] = []

      The array of names to use e.g. ['canOpen', 'canClose']

    Returns BitMask<T>

Properties

bits: T[]
value: number

The current value of the mask

Methods

  • Parameters

    • bit: number
    • value: boolean

    Returns void

  • Returns an array of indexes in the bits array that are currently true.

    Returns number[]

  • Sets all values in the mask to true if they are in the array and false if they are not.

    Parameters

    • indexs: number[]

      An array of indexes in the bits array that need to be true.1

    Returns void

  • Checks the given bit name for its boolean value.

    Parameters

    • name: T

      The name of the bit to check. e.g. canOpen

    Returns boolean

  • Sets the given bit to the supplied value.

    Parameters

    • name: T

      The name of the bit to set e.g. canClose

    • value: boolean

      The boolean value to set it to.

    Returns void

Generated using TypeDoc