|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--calypso.util.QSort
Implements QuickSort, on an array of objects. An implementor of `Comparer' is passed in to compare two objects.
Constructor Summary | |
QSort(Comparer c)
Create a QSort object. |
Method Summary | |
void |
sort(java.lang.Object[] list)
Sorts the array, according to the Comparer. |
void |
sort(java.lang.Object[] list,
int start,
int end)
Sorts a subsequence of the array, according to the Comparer. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public QSort(Comparer c)
QSort sorter = new QSort(new Comparer() { public int compare(Object a, Object b) { if (a.key == b.key) return 0; else if (a.key < b.key) return -1; else return 1; } }); sorter.sort(array);
Method Detail |
public void sort(java.lang.Object[] list)
public void sort(java.lang.Object[] list, int start, int end)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |