Class: FlatKit::SentinelInternalNode
- Inherits:
-
Object
- Object
- FlatKit::SentinelInternalNode
- Includes:
- Comparable
- Defined in:
- lib/flat_kit/sentinel_internal_node.rb
Overview
Private: The Sentinel Internal Node is a private class used by the MergeTree class.
This class represents an empty / completed node in the merge tree where all the data from the descendant leaf node is full used up.
Instance Attribute Summary collapse
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#next_level ⇒ Object
Returns the value of attribute next_level.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#winner ⇒ Object
readonly
Returns the value of attribute winner.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
A sentinal node is always greater than any other node.
-
#initialize(left: nil, right: nil) ⇒ SentinelInternalNode
constructor
A new instance of SentinelInternalNode.
- #leaf? ⇒ Boolean
- #sentinel? ⇒ Boolean
Constructor Details
#initialize(left: nil, right: nil) ⇒ SentinelInternalNode
Returns a new instance of SentinelInternalNode.
16 17 18 19 20 21 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 16 def initialize(left: nil, right: nil) @left = nil @right = nil @winner = nil @next_level = nil end |
Instance Attribute Details
#left ⇒ Object (readonly)
Returns the value of attribute left.
11 12 13 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 11 def left @left end |
#next_level ⇒ Object
Returns the value of attribute next_level.
14 15 16 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 14 def next_level @next_level end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
12 13 14 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 12 def right @right end |
#winner ⇒ Object (readonly)
Returns the value of attribute winner.
13 14 15 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 13 def winner @winner end |
Instance Method Details
#<=>(other) ⇒ Object
A sentinal node is always greater than any other node
32 33 34 35 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 32 def <=>(other) return 0 if other.sentinel? return 1 end |
#leaf? ⇒ Boolean
27 28 29 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 27 def leaf? true end |
#sentinel? ⇒ Boolean
23 24 25 |
# File 'lib/flat_kit/sentinel_internal_node.rb', line 23 def sentinel? true end |