Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PriorityQueue

The PriorityQeueu class

Hierarchy

  • PriorityQueue

Index

Constructors

constructor

Properties

_comparator

_comparator: Function

_queue

_queue: Array<any>

_tailPos

_tailPos: number

Methods

_defaultComparator

  • _defaultComparator(a: number, b: number): boolean

init

  • init(comparator: Function): void

offer

  • offer(element: object): void
  • Insert an element to the queue

    Parameters

    • element: object

      The element to insert

      • id: number
      • time: number

    Returns void

peek

  • peek(): any
  • Get but not remove the first element in the queue

    Returns any

    The first element

pop

  • pop(): any
  • Get and remove the first element in the queue

    Returns any

    The first element

size

  • size(): number
  • Return the size of the pirority queue

    Returns number

    PirorityQueue size