adds an object to a priorityqueue in log size time . it returns the object if any that was dropped off the heap because it was full . this can be the given parameter in case it is smaller than the full heap 's minimum , and could n't be added , or another object that was previously the smallest value in the heap and now has been replaced by a larger one , or null if the queue was n't yet full with maxsize elements . concode_field_sep int size concode_elem_sep int maxSize concode_elem_sep T[] heap concode_field_sep T add concode_elem_sep Object[] getHeapArray concode_elem_sep void downHeap concode_elem_sep void clear concode_elem_sep boolean remove concode_elem_sep T pop concode_elem_sep Iterator<T> iterator concode_elem_sep T top concode_elem_sep int size concode_elem_sep boolean upHeap concode_elem_sep boolean lessThan concode_elem_sep T getSentinelObject concode_elem_sep T updateTop concode_elem_sep T updateTop
T function ( T arg0 ) { if ( size < maxSize ) { add ( arg0 ) ; return null ; } else if ( size > 0 && ! lessThan ( arg0 , heap [ 1 ] ) ) { T loc0 = heap [ 1 ] ; heap [ 1 ] = arg0 ; updateTop ( ) ; return loc0 ; } else { return arg0 ; } }