You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

All Packages  This Package  Class Hierarchy  Class Search  Index

Class calypso.util.QSort


Implements QuickSort, on an array of objects. An implementor of `Comparer' is passed in to compare two objects.

public class  QSort
     extends java.lang.Object
          // Fields 1
     private Comparer comp;

          // Constructors 1
     public QSort(Comparer);

          // Methods 4
     private int partition(Object[], int, int);
     private void quicksort(Object[], int, int);
     public void sort(Object[]);
     public void sort(Object[], int, int);



   private Comparer comp



   public QSort(Comparer c) 

Create a QSort object. One way to use this would with dynamic class creation:

      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;



   public void sort(Object[] list) 

Sorts the array, according to the Comparer.


   public void sort(Object[] list, 
                    int start, 
                    int end) 

Sorts a subsequence of the array, according to the Comparer.


   private void quicksort(Object[] list, 
                          int p, 
                          int r) 


   private int partition(Object[] list, 
                         int p, 
                         int r) 

All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4