Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • IDGen

Implements

  • Iterable<number>
  • IClear
  • INotify

Index

Constructors

constructor

  • new IDGen(bits?: number, vbits?: number, cap?: number, next?: number): IDGen
  • Parameters

    • Default value bits: number = 32
    • Default value vbits: number = 32 - bits
    • Default value cap: number = 2 ** bits
    • Default value next: number = 0

    Returns IDGen

Properties

Protected _capacity

_capacity: number

Protected _freeID

_freeID: number

Readonly ids

ids: number[]

Protected mask

mask: number

Protected nextID

nextID: number

Protected num

num: number

Protected shift

shift: number

Protected start

start: number

Protected vmask

vmask: number

Accessors

available

  • get available(): number

capacity

  • get capacity(): number
  • set capacity(newCap: number): void
  • Attempts to set new capacity to given value. Capacity can only be increased and the operation is only supported for unversioned instances (i.e. vbits = 0).

    Returns number

  • Attempts to set new capacity to given value. Capacity can only be increased and the operation is only supported for unversioned instances (i.e. vbits = 0).

    Parameters

    • newCap: number

    Returns void

freeID

  • get freeID(): number

used

  • get used(): number

Methods

[Symbol.iterator]

  • [Symbol.iterator](): Generator<number, void, unknown>
  • Returns Generator<number, void, unknown>

addListener

  • addListener(id: string, fn: Listener, scope?: any): boolean
  • {@inheritDoc @thi.ng/api#INotify.addListener}

    Parameters

    • id: string
    • fn: Listener
    • Optional scope: any

    Returns boolean

clear

  • clear(): void

free

  • free(id: number): boolean

has

  • has(id: number): boolean

id

  • id(id: number): number
  • Parameters

    • id: number

    Returns number

next

  • next(): number

Protected nextVersion

  • nextVersion(id: number): number

notify

  • notify(event: Event): void
  • {@inheritDoc @thi.ng/api#INotify.notify}

    Parameters

    • event: Event

    Returns void

removeListener

  • removeListener(id: string, fn: Listener, scope?: any): boolean
  • {@inheritDoc @thi.ng/api#INotify.removeListener}

    Parameters

    • id: string
    • fn: Listener
    • Optional scope: any

    Returns boolean

version

  • version(id: number): number
  • Parameters

    • id: number

    Returns number

Generated using TypeDoc