class Quartz::BinaryHeap(T)
- Quartz::BinaryHeap(T)
- Quartz::PriorityQueue(T)
- Reference
- Object
Overview
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.
Defined in:
quartz/priority_queues/binary_heap.crConstructors
- .new(initial_capacity : Int, &comparator : Duration, Duration, Bool -> Int32)
-
.new(&comparator : Duration, Duration, Bool -> Int32)
Creates a new empty BinaryHeap.
Instance Method Summary
-
#==(other) : Bool
Returns
false
(other can only be aValue
here). - #==(other : BinaryHeap) : Bool
- #clear
- #delete(priority : Duration, event : T) : T?
- #empty? : Bool
- #heapify!
- #inspect(io)
- #next_priority : Duration
- #next_priority(&)
- #peek : T
- #peek(&)
- #peek? : T?
- #pop : T
- #push(priority : Duration, value : T) : self
-
#size : Int32
Returns the number of elements in the heap.
- #to_a : Array(Tuple(Duration, T))
- #to_slice : Slice(Tuple(Duration, T))
Instance methods inherited from class Quartz::PriorityQueue(T)
clear
clear,
delete(priority : Duration, value : T) : T?
delete,
empty? : Bool
empty?,
next_priority : Duration
next_priority,
peek : T
peek,
peek? : T?
peek?,
pop : T
pop,
pop_imminents(&)
pop_imminents,
push(priority : Duration, value : T)
push,
size : Int
size
Constructor methods inherited from class Quartz::PriorityQueue(T)
new(priority_queue : Symbol, &comparator : Duration, Duration, Bool -> Int32) : selfnew(&) new
Instance methods inherited from class Reference
==(other : Quartz::Any)
==
Instance methods inherited from class Object
===(other : Quartz::Any)
===
Constructor Detail
Creates a new empty BinaryHeap.
Instance Method Detail
def ==(other) : Bool
#
Description copied from class Reference
Returns false
(other can only be a Value
here).