drasys.or.alg
Class QuickSort

java.lang.Object
  |
  +--drasys.or.alg.QuickSort

public class QuickSort
extends java.lang.Object
implements SortI, java.io.Serializable

An implementation of the Quick Sort algorithm.

References:

Introduction to Algorithms
    Thomas H. Cormen, et al / Hardcover / Published 1990

See Also:
Serialized Form

Constructor Summary
QuickSort()
          The compare object is not set.
QuickSort(boolean descending)
          If descending is true then the elements will be sorted in high-to-low order.
QuickSort(boolean descending, CompareI compare)
          If descending is true then the elements will be sorted in high-to-low order.
QuickSort(CompareI compare)
          The compare object is set to 'compare'.
 
Method Summary
 CompareI getCompare()
          Returns the comparison object.
 void setAscending()
          Sets order to ascending.
 void setCompare(CompareI compare)
          Sets the comparison object.
 void setDescending()
          Sets order to descending.
 void sort(byte[] array)
          Sort the array elements.
 void sort(byte[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(double[] array)
          Sort the array elements.
 void sort(double[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(float[] array)
          Sort the array elements.
 void sort(float[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(int[] array)
          Sort the array elements.
 void sort(int[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(long[] array)
          Sort the array elements.
 void sort(long[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(java.lang.Object[] array)
          Sort the array elements.
 void sort(java.lang.Object[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(short[] array)
          Sort the array elements.
 void sort(short[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(java.lang.String[] array)
          Sort the array elements.
 void sort(java.lang.String[] array, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(java.util.Vector vector)
          Sort the vector elements.
 void sort(VectorI vector)
          Sort the vector elements.
 void sort(VectorI vector, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 void sort(java.util.Vector vector, int from, int to)
          Sort the elements beginning with 'from' ending with 'to'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuickSort

public QuickSort()
The compare object is not set. The elements will be sorted in low-to-high order.

QuickSort

public QuickSort(boolean descending)
If descending is true then the elements will be sorted in high-to-low order. The compare object is not set.

QuickSort

public QuickSort(CompareI compare)
The compare object is set to 'compare'. The elements will be sorted in low-to-high order.

QuickSort

public QuickSort(boolean descending,
                 CompareI compare)
If descending is true then the elements will be sorted in high-to-low order. The compare object is set to 'compare'.
Method Detail

setCompare

public void setCompare(CompareI compare)
Sets the comparison object.
Specified by:
setCompare in interface SortI

getCompare

public CompareI getCompare()
Returns the comparison object.
Specified by:
getCompare in interface SortI

setDescending

public void setDescending()
Sets order to descending.
Specified by:
setDescending in interface SortI

setAscending

public void setAscending()
Sets order to ascending.
Specified by:
setAscending in interface SortI

sort

public void sort(java.util.Vector vector)
Sort the vector elements.
Specified by:
sort in interface SortI

sort

public void sort(java.util.Vector vector,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(java.lang.Object[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(java.lang.Object[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(long[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(long[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(int[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(int[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(double[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(double[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(java.lang.String[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(java.lang.String[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(VectorI vector)
Sort the vector elements.
Specified by:
sort in interface SortI

sort

public void sort(VectorI vector,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(short[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(short[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(byte[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(byte[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI

sort

public void sort(float[] array)
Sort the array elements.
Specified by:
sort in interface SortI

sort

public void sort(float[] array,
                 int from,
                 int to)
Sort the elements beginning with 'from' ending with 'to'.
Specified by:
sort in interface SortI


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com