Class Queue<T>Sealed

A queue implemented using fixed-length arrays

Type Parameters

  • T

Hierarchy

Constructors

Properties

a_: T[]
offset_: number = 0

offset of array

opts_: undefined | Options<T>
size_: number = 0

queue size

Accessors

  • get capacity(): number
  • returns the capacity of the queue

    Returns number

  • get isEmpty(): boolean
  • Returns true if there is no data in the container

    Returns boolean

  • get isFull(): boolean
  • Returns true if the container has reached the container limit

    Returns boolean

  • get isNotEmpty(): boolean
  • Returns true if there is data in the container

    Returns boolean

  • get isNotFull(): boolean
  • Returns true if the container has not reached the container limit

    Returns boolean

  • get length(): number
  • returns the length of the queue

    Returns number

  • get reverse(): Iterable<T>
  • Sealed

    Returns an object that implements a js Iterable, but it traverses the data in reverse

    Returns Iterable<T>

Methods

  • Traverse the container looking for elements until the callback returns true, then stop looking

    Returns

    whether the element was found

    Parameters

    • callback: ValidCallback<T>

      Determine whether it is the element to be found

    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns boolean

  • get queue element

    Throws

    TypeError

    Throws

    RangeError

    Parameters

    • i: number

    Returns T

  • return js iterator

    Parameters

    • Optional reverse: boolean

      If true, returns an iterator to traverse in reverse

    Returns Iterator<T, any, undefined>

  • Adds all the elements of an container into a string, separated by the specified separator string.

    Type Parameters

    • TO

    Parameters

    • Optional separator: string

      A string used to separate one element of the container from the next in the resulting string. If omitted, the array elements are separated with a comma.

    • Optional callback: MapCallback<T, TO>
    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns string

  • Convert container to array

    Type Parameters

    • TO

    Parameters

    • callback: MapCallback<T, TO>
    • Optional reverse: boolean

      If true, traverse the container in reverse order

    Returns TO[]

  • inserts val at the back of queue

    Returns

    Returns true if successful, if queue is full do nothing and return false

    Parameters

    • val: T

    Returns boolean

  • inserts val at the front of queue

    Returns

    Returns true if successful, if queue is full do nothing and return false

    Parameters

    • val: T

    Returns boolean

  • set queue element

    Throws

    TypeError

    Throws

    RangeError

    Parameters

    • i: number
    • val: T

    Returns void

Generated using TypeDoc