Class: IntervalTree::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/interval-tree-node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nodeObject (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_nodeObject (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_centerObject (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_maxObject (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_centerObject (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