package rebelsky.sorting; import java.util.Comparator; import java.util.Vector; /** * Things that know how to sort collections of other things. * * @author Samuel A. Rebelsky * @version 1.0 of November 2004 */ public interface Sorter { /* * Sort Vector v by placing the elements of v in ascending order * according to the rules of Comparator c. * * @pre * All elements of v should be acceptable as parameters of c.compare. * @post * The vector is now sorted. That is, * for(int i = 1; i < v.size; i++) c.compare(v[i-1],v[i]) <= 0. * @post * Result will be a permutation of the original v. * @exception ClassCastException * when elements of v are not accepted as parameters of c. */ public void sort(Vector v, Comparator c) throws ClassCastException; } // interface Sorter