Class: IntervalTree::Node
- Inherits:
-
Object
- Object
- IntervalTree::Node
- Defined in:
- lib/interval-tree-node.rb
Instance Attribute Summary collapse
-
#left_node ⇒ Object
readonly
Returns the value of attribute left_node.
-
#right_node ⇒ Object
readonly
Returns the value of attribute right_node.
-
#s_center ⇒ Object
readonly
Returns the value of attribute s_center.
-
#s_max ⇒ Object
readonly
Returns the value of attribute s_max.
-
#x_center ⇒ Object
readonly
Returns the value of attribute x_center.
Instance Method Summary collapse
-
#initialize(x_center, s_center, left_node, right_node) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(x_center, s_center, left_node, right_node) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 10 11 |
# File 'lib/interval-tree-node.rb', line 5 def initialize(x_center, s_center, left_node, right_node) @x_center = x_center @s_center = s_center.sort_by(&:first) @s_max = s_center.map(&:last).max @left_node = left_node @right_node = right_node end |
Instance Attribute Details
#left_node ⇒ Object (readonly)
Returns the value of attribute left_node.
12 13 14 |
# File 'lib/interval-tree-node.rb', line 12 def left_node @left_node end |
#right_node ⇒ Object (readonly)
Returns the value of attribute right_node.
12 13 14 |
# File 'lib/interval-tree-node.rb', line 12 def right_node @right_node end |
#s_center ⇒ Object (readonly)
Returns the value of attribute s_center.
12 13 14 |
# File 'lib/interval-tree-node.rb', line 12 def s_center @s_center end |
#s_max ⇒ Object (readonly)
Returns the value of attribute s_max.
12 13 14 |
# File 'lib/interval-tree-node.rb', line 12 def s_max @s_max end |
#x_center ⇒ Object (readonly)
Returns the value of attribute x_center.
12 13 14 |
# File 'lib/interval-tree-node.rb', line 12 def x_center @x_center end |