| java.lang.Object com.uwyn.rife.tools.Sort
All known Subclasses: com.uwyn.rife.tools.SortListComparables,
Sort | abstract public class Sort (Code) | | Generic class that implements the quicksort algorithm. Extending classes
have to implement the abstract methods so that the sorting algorithm can
perform the appropriate modifications to the extending class's
datastructure.
author: Geert Bevin (gbevin[remove] at uwyn dot com) version: $Revision: 3634 $ since: 1.0 |
Method Summary | |
abstract protected int | compare(Object element1, Object element2) Compares the entries, determining which one comes before the other.
Parameters: element1 - An Object instance containing the firstentry. Parameters: element2 - An Object instance containing the secondentry. | abstract protected Object | elementAt(Object dataToSort, int position) Retrieves an entry from a certain position within the specified
datastructure.
Parameters: dataToSort - An Object instance that points to thedatastructure from where the entry has to be retrieved. Parameters: position - An integer with the position of the entry that has to beretrieved. | final protected void | quickSort(Object dataToSort, int lo0, int hi0, boolean ascending) This method contains the actual sorting algorithm. | final public void | sort(Object dataToSort, int lastElementPosition, boolean ascending) Starts the sorting of the provided datastructure.
Parameters: dataToSort - An Object instance that points to thedatastructure that has to be sorted. | abstract protected void | swap(Object dataToSort, int position1, int position2) Swaps the position of two entries in the provided datastructure. |
compare | abstract protected int compare(Object element1, Object element2)(Code) | | Compares the entries, determining which one comes before the other.
Parameters: element1 - An Object instance containing the firstentry. Parameters: element2 - An Object instance containing the secondentry. 0 if the two entries are equals; oran integer <0 if the first entry comes before the secondone; or an integer >0 if the first entry comes after the secondone since: 1.0 |
elementAt | abstract protected Object elementAt(Object dataToSort, int position)(Code) | | Retrieves an entry from a certain position within the specified
datastructure.
Parameters: dataToSort - An Object instance that points to thedatastructure from where the entry has to be retrieved. Parameters: position - An integer with the position of the entry that has to beretrieved. An Object instace containing the entry at thespecified position. since: 1.0 |
quickSort | final protected void quickSort(Object dataToSort, int lo0, int hi0, boolean ascending)(Code) | | This method contains the actual sorting algorithm.
Parameters: dataToSort - An Object instance that points to thedatastructure that has to be sorted. Parameters: lo0 - An integer indicating the bottom boundary of the range thatwill be sorted. Parameters: hi0 - An integer indicating the upper boundary of the range thatwill be sorted. Parameters: ascending - true of the data has to be sorted in an ascendingfashion and false otherwise since: 1.0 |
sort | final public void sort(Object dataToSort, int lastElementPosition, boolean ascending)(Code) | | Starts the sorting of the provided datastructure.
Parameters: dataToSort - An Object instance that points to thedatastructure that has to be sorted. The extending class should know howto manipulate this particular datastructure. Parameters: lastElementPosition - An integer that specifies the position of thelast element in the provided datastructure. Parameters: ascending - true of the data has to be sorted in an ascendingfashion and false otherwise since: 1.0 |
swap | abstract protected void swap(Object dataToSort, int position1, int position2)(Code) | | Swaps the position of two entries in the provided datastructure. This is
an abstract method that needs to be implemented by every extending class.
Parameters: dataToSort - An Object instance that points to thedatastructure in which the entries have to be swapped. Parameters: position1 - An integer with the position of the first entry. Parameters: position2 - An integer with the position of the second entry. since: 1.0 |
|
|