inserts new dir with two values
(int dirShift, Store store, int level, long index1, long value1, long index2, long value2)
| 379 | * inserts new dir with two values |
| 380 | */ |
| 381 | static long treePutSub(int dirShift, Store store, int level, long index1, long value1, long index2, long value2) { |
| 382 | if(CC.ASSERT && level<0) |
| 383 | throw new DBException.DataCorruption("level too low"); |
| 384 | if(CC.ASSERT && (dirShift<0||dirShift>maxDirShift)) |
| 385 | throw new AssertionError(); |
| 386 | if(CC.ASSERT && index1>>>((level+1)*dirShift)!=index2>>>((level+1)*dirShift)){ |
| 387 | throw new DBException.DataCorruption("inconsistent index"); |
| 388 | } |
| 389 | int pos1 = treePos(dirShift, level, index1); |
| 390 | int pos2 = treePos(dirShift, level, index2); |
| 391 | long[] dir = dirEmpty(); |
| 392 | if(pos1==pos2){ |
| 393 | //insert new dir |
| 394 | long recid = treePutSub(dirShift, store, level-1, index1, value1, index2, value2); |
| 395 | dir = dirPut(dir, pos1, recid, 0L);//allocate after recursive call to save memory |
| 396 | }else{ |
| 397 | //insert two records into this dir |
| 398 | dir = dirPut(dir, pos1, value1, index1+1); |
| 399 | dir = dirPut(dir, pos2, value2, index2+1); |
| 400 | } |
| 401 | return store.put(dir, dirSer); |
| 402 | } |
| 403 | |
| 404 | static boolean treeRemove(int dirShift, |
| 405 | long recid, |