PokéRogue
    Preparing search index...

    Class PriorityQueue<T>Abstract

    Abstract class representing a Min-priority queue.

    Dynamically updates ordering to always return the "highest priority" item, based on the implementation of reorder.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    queue: T[] = []

    The items in the queue.

    Methods

    • Parameters

      • condition: (t: T) => boolean

      Returns T | undefined

      An element matching the condition function

    • Parameters

      • condition: (t: T) => boolean

      Returns boolean

      Whether an element matching the condition function exists

    • Sealed

      Reorder the queue before removing and returning the highest priority element.

      Returns T | undefined

      The front-most element of the queue after sorting, or undefined if the queue is empty.

    • Remove the first element in the queue matching a given condition.

      Parameters

      • condition: (t: T) => boolean

        If provided, will restrict the removal to only entries matching the given condition

      Returns boolean

      Whether a removal occurred