Interface PriorityQueueNode<T>Internal

Priority queue node.

interface PriorityQueueNode<T> {
    capacity: number;
    enablePriority: boolean;
    next?: FixedPriorityQueue<T>;
    size: number;
    [iterator](): Iterator<T, any, undefined>;
    clear(): void;
    dequeue(): undefined | T;
    empty(): boolean;
    enqueue(data, priority?): number;
    full(): boolean;
    get(index): undefined | T;
}

Type Parameters

  • T

    Type of priority queue node data.

Hierarchy (view full)

Properties

capacity: number

The fixed priority queue capacity.

enablePriority: boolean

Whether to enable priority.

size: number

The fixed priority queue size.

Methods

  • Enqueue data into the fixed priority queue.

    Parameters

    • data: T

      Data to enqueue.

    • Optional priority: number

      Priority of the data. Lower values have higher priority.

    Returns number

    The new size of the priority queue.

    Throws

    If the fixed priority queue is full.

  • Gets data from the fixed priority queue.

    Parameters

    • index: number

      The index of the data to get.

    Returns undefined | T

    The data at the index or undefined if the fixed priority queue is empty or the index is out of bounds.