Permalink
Browse files

Internal method name change: 'insert' -> 'store'

Follows name convention of tree data structure.
  • Loading branch information...
1 parent 8c41f50 commit f80bf6ad8dac41af111d23dc859a6fdd6d657d2b @nahi committed Feb 4, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/avl_tree.rb
View
@@ -26,7 +26,7 @@ def each(&block)
end
# returns new_root
- def store(key, value)
+ def insert(key, value)
Node.new(key, value)
end
@@ -108,14 +108,14 @@ def values
end
# returns new_root
- def store(key, value)
+ def insert(key, value)
case key <=> @key
when -1
- @left = @left.store(key, value)
+ @left = @left.insert(key, value)
when 0
@value = value
when 1
- @right = @right.store(key, value)
+ @right = @right.insert(key, value)
end
rotate
end
@@ -355,9 +355,9 @@ def clear
end
def []=(key, value)
- @root = @root.store(key.to_s, value)
+ @root = @root.insert(key.to_s, value)
end
- alias store []=
+ alias insert []=
def key?(key)
@root.retrieve(key.to_s) != Node::UNDEFINED

0 comments on commit f80bf6a

Please sign in to comment.