private final LeafNode < K , V > findLeafNode ( final K key , final boolean tracePath ) { Node < K , V > node = getNode ( rootIdx ) ; if ( tracePath ) { stackNodes . clear ( ) ; stackSlots . clear ( ) ; } while ( ! node . isLeaf ( ) ) { final InternalNode < K , V > nodeInternal = ( InternalNode < K , V > ) node ; int slot = node . findSlotByKey ( key ) ; slot = ( ( slot < 0 ) ? ( - slot ) - 1 : slot + 1 ) ; if ( tracePath ) { stackNodes . push ( nodeInternal ) ; stackSlots . push ( slot ) ; } node = getNode ( nodeInternal . childs [ slot ] ) ; if ( node == null ) { log . error ( "ERROR childs[" + slot + "] in node=" + nodeInternal ) ; return null ; } } return ( node . isLeaf ( ) ? ( LeafNode < K , V > ) node : null ) ; }
Find node that can hold the key