Oracle Data-aware Controls Reference

oracle.dacf.util
Class QuickSort

java.lang.Object
  extended byoracle.dacf.util.AbstractSort
      extended byoracle.dacf.util.QuickSort
All Implemented Interfaces:
Sortter

public class QuickSort
extends AbstractSort

This is a generic version of C.A.R Hoare's Quick Sort algorithm. This will handle arrays that are already sorted, and arrays with duplicate keys.
If you think of a one dimensional array as going from the lowest index on the left to the highest index on the right then the parameters to this function are lowest index or left and highest index or right. The first time you call this function it will be with the parameters 0, a.length - 1. You will need to define a comparison method using the Compare interface and set the comparer before calling sort. If this is not done, then an IllegalArgumentException will be thrown. A default swapper is implemented so that it is not necessary to define an instance of the Swapper interface.

See Also:
Compare, Swapper, AbstractSort

Field Summary
 
Fields inherited from class oracle.dacf.util.AbstractSort
comparer, swapper
 
Constructor Summary
QuickSort()
           
 
Method Summary
 void sort(java.lang.Object[] a)
          Sorts the items.
 
Methods inherited from class oracle.dacf.util.AbstractSort
getComparer, getSwapper, setComparer, setSwapper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuickSort

public QuickSort()
Method Detail

sort

public void sort(java.lang.Object[] a)
Sorts the items.

Specified by:
sort in interface Sortter
Specified by:
sort in class AbstractSort
Parameters:
a - the array of objects to be sorted.
Throws:
java.lang.IllegalArgumentException - if the comparer is not defined

Oracle Data-aware Controls Reference

 

Copyright © 1997, 2003, Oracle. All rights reserved.