Class: UnifiedQueues::Single::Driver::ContainersDriver::Heap
- Inherits:
-
UnifiedQueues::Single::Driver
- Object
- UnifiedQueues::Single::Driver
- UnifiedQueues::Single::Driver::ContainersDriver::Heap
- Defined in:
- lib/unified-queues/single/driver/algorithms.rb
Overview
Fibonacci heap queue driver. Uses the Containers::Heap
class from algorithms
gem for queueing. Priority is supported.
Instance Attribute Summary
Attributes inherited from UnifiedQueues::Single::Driver
Instance Method Summary collapse
-
#clear! ⇒ Object
Clears the queue.
-
#empty? ⇒ Boolean
Indicates queue is empty.
-
#length ⇒ Integer
Returns length of the queue.
-
#pop(blocking = false) ⇒ Object
Pops value out of the queue.
-
#push(value, key = value) ⇒ Object
Pushes the value into the queue.
-
#type ⇒ :linear
Returs type of the queue.
Methods inherited from UnifiedQueues::Single::Driver
#evented?, #initialize, #linear?
Constructor Details
This class inherits a constructor from UnifiedQueues::Single::Driver
Instance Method Details
#clear! ⇒ Object
Clears the queue.
74 75 76 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 74 def clear! @native.clear end |
#empty? ⇒ Boolean
Indicates queue is empty.
66 67 68 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 66 def empty? @native.empty? end |
#length ⇒ Integer
Returns length of the queue.
83 84 85 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 83 def length @native.size end |
#pop(blocking = false) ⇒ Object
Pops value out of the queue. Note, value with minimal priority will be popped out. Blocking isn’ŧ supported.
57 58 59 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 57 def pop(blocking = false) @native.pop end |
#push(value, key = value) ⇒ Object
Pushes the value into the queue. Priority is supported.
45 46 47 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 45 def push(value, key = value) @native.push(key, value) end |
#type ⇒ :linear
Returs type of the queue.
92 93 94 |
# File 'lib/unified-queues/single/driver/algorithms.rb', line 92 def type :linear end |