|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.uwyn.rife.tools.Sort
com.uwyn.rife.tools.SortListComparables
public class SortListComparables
Extends the Sort class to implement the features that are
needed to sort an List datastructure containing only
objects that implement the Comparable interface.
Sort| Constructor Summary | |
|---|---|
SortListComparables()
|
|
| Method Summary | |
|---|---|
protected int |
compare(Object element1,
Object element2)
Compares the entries, determining which one comes before the other. |
protected Object |
elementAt(Object dataToSort,
int position)
Retrieves an entry from a certain position within the specified datastructure. |
void |
sort(List<? extends Comparable> dataToSort)
Starts the sorting of the entire ArrayList. |
void |
sort(List<? extends Comparable> dataToSort,
boolean ascending)
Starts the sorting of the entire ArrayList. |
protected void |
swap(Object dataToSort,
int position1,
int position2)
Swaps the position of two entries in the provided datastructure. |
| Methods inherited from class com.uwyn.rife.tools.Sort |
|---|
quickSort, sort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SortListComparables()
| Method Detail |
|---|
public final void sort(List<? extends Comparable> dataToSort)
dataToSort - An ArrayList instance that has to be
sorted.
public final void sort(List<? extends Comparable> dataToSort,
boolean ascending)
dataToSort - An ArrayList instance that has to be
sorted.ascending - true of the data has to be sorted in an ascending
fashion and false otherwise
protected void swap(Object dataToSort,
int position1,
int position2)
Sort
swap in class SortdataToSort - An Object instance that points to the
datastructure in which the entries have to be swapped.position1 - An integer with the position of the first entry.position2 - An integer with the position of the second entry.
protected Object elementAt(Object dataToSort,
int position)
Sort
elementAt in class SortdataToSort - An Object instance that points to the
datastructure from where the entry has to be retrieved.position - An integer with the position of the entry that has to be
retrieved.
Object instace containing the entry at the
specified position.
protected int compare(Object element1,
Object element2)
Sort
compare in class Sortelement1 - An Object instance containing the first
entry.element2 - An Object instance containing the second
entry.
0 if the two entries are equals; or
an integer <0 if the first entry comes before the second
one; or
an integer >0 if the first entry comes after the second
one
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||