projects
/
org.ibex.core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3ac6733
)
2003/11/30 02:15:58
author
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:42:29 +0000
(07:42 +0000)
committer
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 07:42:29 +0000
(07:42 +0000)
darcs-hash:
20040130074229
-2ba56-
faef1a662e47df8e13ce65d84166d4aba8626680
.gz
src/org/xwt/util/BalancedTree.java
patch
|
blob
|
history
diff --git
a/src/org/xwt/util/BalancedTree.java
b/src/org/xwt/util/BalancedTree.java
index
09e97dc
..
0aebcde
100644
(file)
--- a/
src/org/xwt/util/BalancedTree.java
+++ b/
src/org/xwt/util/BalancedTree.java
@@
-29,11
+29,14
@@
public class BalancedTree {
if (index < 0) index = 0;
if (index > treeSize()) index = treeSize();
int arg = allocateSlot(o);
if (index < 0) index = 0;
if (index > treeSize()) index = treeSize();
int arg = allocateSlot(o);
- if (root != 0) { insert(index, arg, root, 0, false, false); return; }
- root = arg;
- left[arg] = 0;
- right[arg] = 0;
- size[root] = 1;
+ if (root != 0) {
+ insert(index, arg, root, 0, false, false);
+ } else {
+ root = arg;
+ left[arg] = 0;
+ right[arg] = 0;
+ size[root] = 1;
+ }
}
/** clamps index to [0..treeSize()-1] and replaces the object at that index with object o */
}
/** clamps index to [0..treeSize()-1] and replaces the object at that index with object o */
@@
-238,6
+241,7
@@
public class BalancedTree {
if (slot == root) {
root = arg;
balance(slot, arg);
if (slot == root) {
root = arg;
balance(slot, arg);
+ balance(arg, 0);
} else {
(left[parent] == slot ? left : right)[parent] = arg;
balance(slot, arg);
} else {
(left[parent] == slot ? left : right)[parent] = arg;
balance(slot, arg);