private void delete ( ReflectedHandle < K , V > n ) { if ( n . inner == null && free != n ) { throw new IllegalArgumentException ( "Invalid handle!" ) ; } if ( free == n ) { free = null ; } else { // delete from inner queue AddressableHeap . Handle < K , HandleMap < K , V > > nInner = n . inner ; ReflectedHandle < K , V > nOuter = nInner . getValue ( ) . outer ; nInner . delete ( ) ; nOuter . inner = null ; nOuter . minNotMax = false ; // delete pair from inner queue AddressableHeap . Handle < K , HandleMap < K , V > > otherInner = nInner . getValue ( ) . otherInner ; ReflectedHandle < K , V > otherOuter = otherInner . getValue ( ) . outer ; otherInner . delete ( ) ; otherOuter . inner = null ; otherOuter . minNotMax = false ; // reinsert either as free or as pair with free if ( free == null ) { free = otherOuter ; } else { insertPair ( otherOuter , free ) ; free = null ; } } size -- ; }
Delete an element