private void refresh(RNode part1, RNode part2) throws DimensionalException { if (part1 == root) { if (part2 != null) { // build new root and add children. root = makeRoot(false); root.addChild(part1); part1.setParent(root); root.addChild(part2); part2.setParent(root); } update(root); return; } update(part1); if (part2 != null) { update(part2); if (part1.getParent().getChildren().size() > M_order) { RNode[] splits = makePartition(part1.getParent()); refresh(splits[0], splits[1]); } } if (part1.getParent() != null) { refresh(part1.getParent(), null); } }