com.partnersoft.data
Class SortingLib

java.lang.Object
  extended by com.partnersoft.data.SortingLib
All Implemented Interfaces:
Lib

public class SortingLib
extends java.lang.Object
implements Lib

Functions to sort random-access, array-like objects.

Copyright 2000-2006 Partner Software, Inc.

Author:
Paul Reavis

Method Summary
static void quickSort(SortingGopher gopher)
          Convenience method to apply the QuickSort algorithm to the given gopher.
static void selectionSort(SortingGopher gopher)
          Convenience method to apply the SelectionSort algorithm to the given gopher.
static void sort(SortingGopher gopher)
          Convenience method for when you don't particularly care which sort method is used.
static void sort3(SortingGopher gopher, int a, int b, int c)
          Low-level comparison of three items at the given indices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

sort3

public static void sort3(SortingGopher gopher,
                         int a,
                         int b,
                         int c)
Low-level comparison of three items at the given indices. Used by SortingAlgorithm implementations.

Parameters:
gopher - gopher providing access to underlying array-like structure
a - first index to sort
b - second index to sort
c - third index to sort

sort

public static void sort(SortingGopher gopher)
Convenience method for when you don't particularly care which sort method is used. (psst... it uses quickSort(SortingGopher)).

Parameters:
gopher - gopher providing access to underlying array-like structure

quickSort

public static void quickSort(SortingGopher gopher)
Convenience method to apply the QuickSort algorithm to the given gopher.

Parameters:
gopher - gopher providing access to underlying array-like structure
See Also:
QuickSort

selectionSort

public static void selectionSort(SortingGopher gopher)
Convenience method to apply the SelectionSort algorithm to the given gopher.

Parameters:
gopher - gopher providing access to underlying array-like structure
See Also:
SelectionSort