rightBNode.setNodeType(oldType);
int h = nodeCapacity / 2;
int i = 0;
if (oldType.equals("leaf")) {
while (i < h) {
Jid e = (Jid) oldRootNode.iGet(i);
byte[] bytes = e.getSerializedBytes();
leftBNode.iAddBytes(-1, bytes);
i += 1;
}
while (i < nodeCapacity) {
Jid e = (Jid) oldRootNode.iGet(i);
byte[] bytes = e.getSerializedBytes();
rightBNode.iAddBytes(-1, bytes);
i += 1;
}
} else {
while (i < h) {
BMapJid<KEY_TYPE, Jid> e = (BMapJid) oldRootNode.iGet(i).getValue();
int eSize = e.size();
byte[] bytes = e.getSerializedBytes();
leftBNode.append(bytes, eSize);
i += 1;
}
while (i < nodeCapacity) {
BMapJid<KEY_TYPE, Jid> e = (BMapJid) oldRootNode.iGet(i).getValue();
int eSize = e.size();
byte[] bytes = e.getSerializedBytes();
rightBNode.append(bytes, eSize);
i += 1;
}
}
leftEntry.setKey(leftBNode.getLastKey());