private NodeBuilder ascend ( ) { ensureParent ( ) ; boolean isLeaf = isLeaf ( copyFrom ) ; if ( buildKeyPosition > FAN_FACTOR ) { // split current node and move the midpoint into parent, with the two halves as children int mid = buildKeyPosition / 2 ; parent . addExtraChild ( buildFromRange ( 0 , mid , isLeaf , true ) , buildKeys [ mid ] ) ; parent . finishChild ( buildFromRange ( mid + 1 , buildKeyPosition - ( mid + 1 ) , isLeaf , false ) ) ; } else { parent . finishChild ( buildFromRange ( 0 , buildKeyPosition , isLeaf , false ) ) ; } return parent ; }
finish up this level and pass any constructed children up to our parent ensuring a parent exists