jdsl.core.algo.sorts
Interface SortObject

All Known Implementing Classes:
ArrayQuickSort, ListMergeSort, ArrayMergeSort, ListQuickSort, HeapSort

public interface SortObject

Algorithm interface for sorting a sequence according to a given comparator of elements. All sorting algorithms are expected to modify the Sequence passed in as a parameter (no new Sequence is returned). No guarantee is made that the Position-element binding is preserved, or even that positions and their decorations are preserved.

If the comparator encounters an element which it is unable to compare, a ClassCastException will be thrown, as is documented in the EqualityComparator and Comparator interfaces in jdsl.core.api.

Running times (time complexities) given for individual algorithms depend on the assumption that the comparator can compare two elements in constant time.

Version:
$Id: SortObject.java,v 1.5 2000/01/12 03:21:23 mdh Exp $
Author:
Benoit Hudson, Keith Schmidt

Method Summary
 void sort(Sequence s, Comparator c)
          Method that actually sorts the sequence, with the first element after the sort being the one that the comparator reported was smallest.
 

Method Detail

sort

public void sort(Sequence s,
                 Comparator c)
Method that actually sorts the sequence, with the first element after the sort being the one that the comparator reported was smallest.
Parameters:
s - sequence to be sorted
c - comparator which defines in which order S is sorted