Class sort

java.lang.Object
  |
  +--sort
Direct Known Subclasses:
selectionSort

public abstract class sort
extends java.lang.Object

The class sort uses the "selelction sort" algorithm to sord a list of comaparable obects. Comparable objects can be compared to each other, that is if we take two such objects then there is a routine, a method, that compares them and reports one to be smaller or declares them as equal. As far as the sort routine is concerned this is all that is needed to carry out the sorting operation. The nature of data and the exact meahnism of sorting is irrelevant. The sort routine works on a comparable object C and uses its compare method to carry out the actual comapring. The source code


Field Summary
protected  comparable C
           
 
Constructor Summary
sort(comparable C)
          Constructor for the sort class
 
Method Summary
abstract  void sortit()
           
protected  void swap(int i, int j)
          Swap the ith and jth elements of the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C

protected comparable C
Constructor Detail

sort

public sort(comparable C)
Constructor for the sort class
Method Detail

swap

protected void swap(int i,
                    int j)
Swap the ith and jth elements of the list. Since the exact nature of the data in the list is not known, they are teated as Object types.

sortit

public abstract void sortit()