class

Quartz::BinaryHeap(T)

Inherits Quartz::PriorityQueue / Reference / Object

Event set implemented as an array-based heap.

Each inserted elements is given a certain priority, based on the result of the comparison. This is a min-heap, which means retrieving an element will always return the one with the highest priority.

To avoid O(n) complexity when deleting an arbitrary element, a map is used to store indices for each element in the event set.

Constructors

new(initial_capacity : Int, &comparator : Duration, Duration, Bool -> Int32)
Source
new

Creates a new empty BinaryHeap.

Source

Instance methods

==(other : BinaryHeap) : Bool
Source
==(other) : Bool

Returns false (other can only be a Value here).

Source
clear
Source
delete(priority : Duration, event : T) : T | Nil
Source
empty?
Source
heapify!
Source
inspect(io)
Source
next_priority
Source
next_priority
Source
peek
Source
peek
Source
peek?
Source
push(priority : Duration, value : T) : self
Source
size

Returns the number of elements in the heap.

Source
to_a
Source
to_slice
Source