protected void deletePath ( IndexTreePath < E > deletionPath ) { N leaf = getNode ( deletionPath . getParentPath ( ) . getEntry ( ) ) ; int index = deletionPath . getIndex ( ) ; // delete o E entry = leaf . getEntry ( index ) ; leaf . deleteEntry ( index ) ; writeNode ( leaf ) ; // condense the tree Stack < N > stack = new Stack <> ( ) ; condenseTree ( deletionPath . getParentPath ( ) , stack ) ; // reinsert underflow nodes while ( ! stack . empty ( ) ) { N node = stack . pop ( ) ; if ( node . isLeaf ( ) ) { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { settings . getOverflowTreatment ( ) . reinitialize ( ) ; // Intended? this . insertLeafEntry ( node . getEntry ( i ) ) ; } } else { for ( int i = 0 ; i < node . getNumEntries ( ) ; i ++ ) { stack . push ( getNode ( node . getEntry ( i ) ) ) ; } } deleteNode ( node ) ; } postDelete ( entry ) ; doExtraIntegrityChecks ( ) ; }
Delete a leaf at a given path - deletions for non - leaves are not supported!