public void reInsert ( N node , IndexTreePath < E > path , int [ ] offs ) { final int depth = path . getPathCount ( ) ; long [ ] remove = BitsUtil . zero ( node . getCapacity ( ) ) ; List < E > reInsertEntries = new ArrayList <> ( offs . length ) ; for ( int i = 0 ; i < offs . length ; i ++ ) { reInsertEntries . add ( node . getEntry ( offs [ i ] ) ) ; BitsUtil . setI ( remove , offs [ i ] ) ; } // Remove the entries we reinsert node . removeMask ( remove ) ; writeNode ( node ) ; // and adapt the mbrs IndexTreePath < E > childPath = path ; N child = node ; while ( childPath . getParentPath ( ) != null ) { N parent = getNode ( childPath . getParentPath ( ) . getEntry ( ) ) ; int indexOfChild = childPath . getIndex ( ) ; if ( child . adjustEntry ( parent . getEntry ( indexOfChild ) ) ) { writeNode ( parent ) ; childPath = childPath . getParentPath ( ) ; child = parent ; } else { break ; // TODO: stop writing when MBR didn't change! } } // reinsert the first entries final Logging log = getLogger ( ) ; for ( E entry : reInsertEntries ) { if ( node . isLeaf ( ) ) { if ( log . isDebugging ( ) ) { log . debug ( "reinsert " + entry ) ; } insertLeafEntry ( entry ) ; } else { if ( log . isDebugging ( ) ) { log . debug ( "reinsert " + entry + " at " + depth ) ; } insertDirectoryEntry ( entry , depth ) ; } } }
Reinserts the specified node at the specified level .