mirror of
https://github.com/corda/corda.git
synced 2025-05-09 20:12:56 +00:00
fix backwards logic in treeMapInsert which prevented correct balancing
This commit is contained in:
parent
15ea90cd0c
commit
2e2925c321
@ -143,7 +143,7 @@ treeAdd(Thread* t, object path)
|
|||||||
if (treeNodeRed
|
if (treeNodeRed
|
||||||
(t, treeNodeRight(t, pairFirst(t, pairSecond(t, ancestors)))))
|
(t, treeNodeRight(t, pairFirst(t, pairSecond(t, ancestors)))))
|
||||||
{
|
{
|
||||||
setTreeNodeRed(t, pairFirst(t, ancestors), true);
|
setTreeNodeRed(t, pairFirst(t, ancestors), false);
|
||||||
|
|
||||||
object n = cloneTreeNode
|
object n = cloneTreeNode
|
||||||
(t, treeNodeRight(t, pairFirst(t, pairSecond(t, ancestors))));
|
(t, treeNodeRight(t, pairFirst(t, pairSecond(t, ancestors))));
|
||||||
@ -154,7 +154,7 @@ treeAdd(Thread* t, object path)
|
|||||||
(t, treeNodeRight
|
(t, treeNodeRight
|
||||||
(t, pairFirst(t, pairSecond(t, ancestors))), false);
|
(t, pairFirst(t, pairSecond(t, ancestors))), false);
|
||||||
|
|
||||||
setTreeNodeRed(t, pairFirst(t, pairSecond(t, ancestors)), false);
|
setTreeNodeRed(t, pairFirst(t, pairSecond(t, ancestors)), true);
|
||||||
|
|
||||||
new_ = pairFirst(t, pairSecond(t, ancestors));
|
new_ = pairFirst(t, pairSecond(t, ancestors));
|
||||||
ancestors = pairSecond(t, pairSecond(t, ancestors));
|
ancestors = pairSecond(t, pairSecond(t, ancestors));
|
||||||
@ -195,7 +195,7 @@ treeAdd(Thread* t, object path)
|
|||||||
if (treeNodeRed
|
if (treeNodeRed
|
||||||
(t, treeNodeLeft(t, pairFirst(t, pairSecond(t, ancestors)))))
|
(t, treeNodeLeft(t, pairFirst(t, pairSecond(t, ancestors)))))
|
||||||
{
|
{
|
||||||
setTreeNodeRed(t, pairFirst(t, ancestors), true);
|
setTreeNodeRed(t, pairFirst(t, ancestors), false);
|
||||||
|
|
||||||
object n = cloneTreeNode
|
object n = cloneTreeNode
|
||||||
(t, treeNodeLeft(t, pairFirst(t, pairSecond(t, ancestors))));
|
(t, treeNodeLeft(t, pairFirst(t, pairSecond(t, ancestors))));
|
||||||
@ -206,7 +206,7 @@ treeAdd(Thread* t, object path)
|
|||||||
(t, treeNodeLeft
|
(t, treeNodeLeft
|
||||||
(t, pairFirst(t, pairSecond(t, ancestors))), false);
|
(t, pairFirst(t, pairSecond(t, ancestors))), false);
|
||||||
|
|
||||||
setTreeNodeRed(t, pairFirst(t, pairSecond(t, ancestors)), false);
|
setTreeNodeRed(t, pairFirst(t, pairSecond(t, ancestors)), true);
|
||||||
|
|
||||||
new_ = pairFirst(t, pairSecond(t, ancestors));
|
new_ = pairFirst(t, pairSecond(t, ancestors));
|
||||||
ancestors = pairSecond(t, pairSecond(t, ancestors));
|
ancestors = pairSecond(t, pairSecond(t, ancestors));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user