nz.ac.waikato.jdsl.core.algo.sorts
Interface SortObject

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

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 nz.ac.waikato.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:
JDSL 2.1.1
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

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


Copyright © 2009 ModelJUnit Project. All Rights Reserved.