Class: ListNode

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/simpleselect/listNode.rb

Overview

tipo nodo que actua como eslabón en la clase List

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ListNode

Returns a new instance of ListNode.



12
13
14
15
16
# File 'lib/simpleselect/listNode.rb', line 12

def initialize(value)
   @value=value
   @next = nil
   @prev = nil
end

Instance Attribute Details

#nextListNode

“puntero” al siguiente nodo de la lista

Returns:

  • the current value of next



6
7
8
# File 'lib/simpleselect/listNode.rb', line 6

def next
  @next
end

#prevListNode

“puntero” al nodo anterior en la lista

Returns:

  • the current value of prev



6
7
8
# File 'lib/simpleselect/listNode.rb', line 6

def prev
  @prev
end

#valueobject

contenido util que encapsulará

Returns:

  • the current value of value



6
7
8
# File 'lib/simpleselect/listNode.rb', line 6

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



8
9
10
# File 'lib/simpleselect/listNode.rb', line 8

def <=> (other)
   @value <=> other.value
end

#to_sObject



17
18
19
# File 'lib/simpleselect/listNode.rb', line 17

def to_s
   @value.to_s
end