public synchronized Object removeObject ( int objectIndex ) throws IndexOutOfBoundsException , NoSuchElementException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeObject" , Integer . valueOf ( objectIndex ) ) ; if ( ( objectIndex < OBJECT_TABLE_ORIGIN ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Invalid object index" ) ; throw new IndexOutOfBoundsException ( ) ; } else if ( ( objectIndex > maxIndex ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Invalid object index" ) ; return null ; } if ( objectTable [ objectIndex ] == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "No object exists at the entry" ) ; throw new NoSuchElementException ( ) ; } Object returnObject = objectTable [ objectIndex ] ; objectTable [ objectIndex ] = null ; /* * If no free slots, make the slot we just freed the next available free slot */ if ( freeSlot == MINUS_ONE ) { freeSlot = objectIndex ; } /* * If slot we just free is less than next available free slot, set next * available free slot to this. */ else { freeSlot = Math . min ( freeSlot , objectIndex ) ; } /* * If the high water mark is equal to the index of the slot that we just * freed, decrement the high water mark by one until we reach the next slot * in use. */ if ( highWatermark == objectIndex ) { while ( objectTable [ highWatermark ] == null ) { if ( highWatermark == OBJECT_TABLE_ORIGIN ) { break ; } highWatermark = ( highWatermark - 1 ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeObject" , returnObject ) ; return returnObject ; }
removeObject - remove an object from the object store .