Class: DSA::SkipListNode
- Inherits:
-
Object
- Object
- DSA::SkipListNode
- Defined in:
- lib/DSA/skip_list.rb
Instance Attribute Summary collapse
-
#down ⇒ Object
Returns the value of attribute down.
-
#key ⇒ Object
Returns the value of attribute key.
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#up ⇒ Object
Returns the value of attribute up.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value = nil) ⇒ SkipListNode
constructor
A new instance of SkipListNode.
- #is_sentinel? ⇒ Boolean
Constructor Details
#initialize(key, value = nil) ⇒ SkipListNode
Returns a new instance of SkipListNode.
4 5 6 7 8 9 10 11 |
# File 'lib/DSA/skip_list.rb', line 4 def initialize(key, value = nil) @key = key @value = value @prev = nil @next = nil @up = nil @down = nil end |
Instance Attribute Details
#down ⇒ Object
Returns the value of attribute down.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def down @down end |
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def key @key end |
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def prev @prev end |
#up ⇒ Object
Returns the value of attribute up.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def up @up end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/DSA/skip_list.rb', line 3 def value @value end |
Instance Method Details
#is_sentinel? ⇒ Boolean
13 14 15 |
# File 'lib/DSA/skip_list.rb', line 13 def is_sentinel? @key.equal? SkipListLevel::SENTINEL end |