|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--arlut.csd.Util.VecQuickSort
QuickSort implementation for Vector. Uses the
Compare interface for item
comparisons.
Based on code by Eric van Bezooijen (eric@logrus.berkeley.edu) and Roedy Green (roedy@bix.com).
| Field Summary | |
(package private) arlut.csd.Util.Compare |
comparator
|
(package private) java.util.Vector |
objects
|
| Constructor Summary | |
VecQuickSort(java.util.Vector objects,
arlut.csd.Util.Compare comparator)
VecQuickSort constructor. |
|
| Method Summary | |
int |
compare(java.lang.Object a,
java.lang.Object b)
Default comparator, does a string comparison on the toString() output of the objects for ordering. |
private int |
partition(int first,
int last)
Partition by splitting this chunk to sort in two and get all big elements on one side of the pivot and all the small elements on the other. |
private void |
quick(int first,
int last)
|
void |
sort()
Sort the elements |
private void |
swap(int i,
int j)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
java.util.Vector objects
arlut.csd.Util.Compare comparator
| Constructor Detail |
public VecQuickSort(java.util.Vector objects,
arlut.csd.Util.Compare comparator)
objects - Vector of objects to be sorted in placecomparator - Compare object.. if null, standard string compare
will be done.| Method Detail |
private void quick(int first,
int last)
private int partition(int first,
int last)
Partition by splitting this chunk to sort in two and get all big elements on one side of the pivot and all the small elements on the other.
private void swap(int i,
int j)
public void sort()
Sort the elements
public int compare(java.lang.Object a,
java.lang.Object b)
Default comparator, does a string comparison on the toString() output of the objects for ordering.
compare in interface Compare
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||