Skip to content

Commit

Permalink
Fixed a bug in choose_leaf during insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
cchandler committed Jun 28, 2009
1 parent 72844ec commit 1390c55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
*.beam
*.dump
4 changes: 2 additions & 2 deletions rtree.erl
Expand Up @@ -77,7 +77,7 @@ new_tree() -> #rtree{root= #node{}, min_node_entries=1, max_node_entries=3}.
insert(_RTree, {}) -> ok;
insert(#rtree{root=RTreeRoot}=RTree, {Figure, Data}=NewRecord) ->
NodePath = choose_leaf(RTreeRoot,Figure,[]),
io:format("Node Path to LeafNode= ~p ~n", [NodePath]),
io:format("Node Path to LeafNode= ~p ~n", [length(NodePath)]),
Node = lists:last(NodePath),
NewValues = lists:append(Node#node.values, [Figure]),
NewRoot = update_node(RTree,RTree#rtree.root,NodePath,NewValues),
Expand Down Expand Up @@ -489,6 +489,6 @@ choose_leaf(Node, Figure, Path) ->
Acc
end
end, {infinity,[]}, Node#node.children),
Path ++ choose_leaf(NextNode, Figure, Path)
choose_leaf(NextNode, Figure, Path ++ [NextNode])
end.

0 comments on commit 1390c55

Please sign in to comment.