Class: Priorityq::PriorityQueue::Element

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/priorityq/priority_queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(priority, value) ⇒ Element

Returns a new instance of Element.



8
9
10
11
# File 'lib/priorityq/priority_queue.rb', line 8

def initialize(priority, value)
  @priority = priority
  @value = value
end

Instance Attribute Details

#priorityObject (readonly)

Returns the value of attribute priority.



6
7
8
# File 'lib/priorityq/priority_queue.rb', line 6

def priority
  @priority
end

#valueObject (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/priorityq/priority_queue.rb', line 6

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



13
14
15
# File 'lib/priorityq/priority_queue.rb', line 13

def <=>(other)
  priority <=> other.priority
end