entry = entry.getNextKey();
}
// create new blank node for key entry relationship
Node blankNode = bTree.getGraphDb().createNode();
NodeEntry nodeEntry = createEntry(keyEntry.getStartNode(), blankNode);
Relationship keyValueRelationship = nodeEntry.addNode( theNode );
// move previous keyEntry to start at blank node
keyEntry.move(this, blankNode, keyEntry.getEndNode());
entryCount++;
assert entryCount <= bTree.getOrder();
if (bTree.getOrder() == entryCount) {
moveMiddleUp();
}
return keyValueRelationship;
}
// else if last entry, check for sub tree or add last
if (keyEntry.getNextKey() == null) {
// check if we have subtree
TreeNode subTree = keyEntry.getAfterSubTree();
if (subTree != null) {
return subTree.addEntry(theNode, ignoreIfExist);
}
// ok just append the element
Node blankNode = bTree.getGraphDb().createNode();
NodeEntry nodeEntry = createEntry(keyEntry.getEndNode(), blankNode);
Relationship keyValueRelationship = nodeEntry.addNode( theNode );
entryCount++;
assert entryCount <= bTree.getOrder();
if (bTree.getOrder() == entryCount) {
moveMiddleUp();
}