public void sort(final IndexedSortable s, final int p, final int r,
      final Progressable rep) {
    final int N = r - p;
    // build heap w/ reverse comparator, then write in-place from end
    final int t = Integer.highestOneBit(N);
    for (int i = t; i > 1; i >>>= 1) {
      for (int j = i >>> 1; j < i; ++j) {
        downHeap(s, p-1, j, N + 1);
      }
      if (null != rep) {
        rep.progress();
      }
    }
    for (int i = r - 1; i > p; --i) {
      s.swap(p, i);
      downHeap(s, p - 1, 1, i - p + 1);
    }
  }
public void sort ( final IndexedSortable s , final int p , final int r , final Progressable rep ) { final int N = r - p ; final int t = Integer . highestOneBit ( N ) ; for ( int i = t ; i > 1 ; i >>>= 1 ) { for ( int j = i > > > 1 ; j < i ; ++ j ) { downHeap ( s , p - 1 , j , N + 1 ) ; } if ( null != rep ) { rep . progress ( ) ; } } for ( int i = r - 1 ; i > p ; -- i ) { s . swap ( p , i ) ; downHeap ( s , p - 1 , 1 , i - p + 1 ) ; } }
{@inheritDoc}