Class: Algorithms::Containers::Heap::Node
- Inherits:
-
Object
- Object
- Algorithms::Containers::Heap::Node
- Defined in:
- lib/containers/heap.rb
Overview
Node class used internally
Instance Attribute Summary collapse
-
#child ⇒ Object
:nodoc:.
-
#degree ⇒ Object
:nodoc:.
-
#key ⇒ Object
:nodoc:.
-
#left ⇒ Object
:nodoc:.
-
#marked ⇒ Object
:nodoc:.
-
#parent ⇒ Object
:nodoc:.
-
#right ⇒ Object
:nodoc:.
-
#value ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(key, value) ⇒ Node
constructor
A new instance of Node.
- #marked? ⇒ Boolean
Constructor Details
#initialize(key, value) ⇒ Node
Returns a new instance of Node.
310 311 312 313 314 315 316 317 |
# File 'lib/containers/heap.rb', line 310 def initialize(key, value) @key = key @value = value @degree = 0 @marked = false @right = self @left = self end |
Instance Attribute Details
#child ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def child @child end |
#degree ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def degree @degree end |
#key ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def key @key end |
#left ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def left @left end |
#marked ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def marked @marked end |
#parent ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def parent @parent end |
#right ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def right @right end |
#value ⇒ Object
:nodoc:
308 309 310 |
# File 'lib/containers/heap.rb', line 308 def value @value end |
Instance Method Details
#marked? ⇒ Boolean
319 320 321 |
# File 'lib/containers/heap.rb', line 319 def marked? @marked == true end |