Class: Containers::Heap::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/containers/heap.rb

Overview

Node class used internally

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Node

Returns a new instance of Node.



308
309
310
311
312
313
314
315
# File 'lib/containers/heap.rb', line 308

def initialize(key, value)
  @key = key
  @value = value
  @degree = 0
  @marked = false
  @right = self
  @left = self
end

Instance Attribute Details

#childObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def child
  @child
end

#degreeObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def degree
  @degree
end

#keyObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def key
  @key
end

#leftObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def left
  @left
end

#markedObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def marked
  @marked
end

#parentObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def parent
  @parent
end

#rightObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def right
  @right
end

#valueObject

:nodoc:



306
307
308
# File 'lib/containers/heap.rb', line 306

def value
  @value
end

Instance Method Details

#marked?Boolean

Returns:

  • (Boolean)


317
318
319
# File 'lib/containers/heap.rb', line 317

def marked?
  @marked == true
end