Method: TreeMap::Node#copy

Defined in:
lib/tree_map/tree_map.rb

#copy(parent) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/tree_map/tree_map.rb', line 53

def copy(parent)
  result = Node.new(@parent, @key)
  if @left
    result.left = @left.copy(result)
  end
  if @right
    result.right = @right.copy(result)
  end
  result.value = @value
  result.height = @height
  result
end