| java.lang.Object org.netbeans.lib.profiler.utils.LongSorter
LongSorter | public class LongSorter (Code) | | An implementation of quick sort for long numbers.
The advantage of this class is that it provides a protected swap(idx1, idx2) method, that can be overridden by a
subclass. This allows one to easily create a subclass of LongSorter, that would sort, for example, a data structure
consisting of several arrays, whose elements at the same index are viewed as a single logical record, and the order
of these records is determined by the order of elements in one long[] array. A subclass to sort such records should
override swap(). The new implementation of swap() should call super.swap() and then take care of swapping the rest
of the "fields" of the two given logical records.
author: Misha Dmitriev |
Constructor Summary | |
public | LongSorter(long[] x, int off, int len) |
Method Summary | |
public void | sort(boolean asc) | protected void | swap(int a, int b) Swaps x[a] with x[b]. |
LongSorter | public LongSorter(long[] x, int off, int len)(Code) | | |
sort | public void sort(boolean asc)(Code) | | Performs sorting in ascending or descending order
Parameters: asc - Defines the order of sorting: true means ascending order, false means descending order. |
swap | protected void swap(int a, int b)(Code) | | Swaps x[a] with x[b]. An subclass may override this method to e.g. swap other data associated with elements of the sorted array
|
|
|