import java.util.Comparator;
import java.util.Vector;

/**
 * Things that can sort.  Right now, we expect sorters to provide
 * only one sort method, which does an "out of place" sort: Returning
 * a new sorted Vector rather than sorting the Vector (or array or
 * list or ...) in place.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of April 2004
 */
public interface Sorter
{
  /**
   * Sort a vector of values using a Comparator to determine the order
   * of the elements in the result vector.  Note that the sort method
   * should not modify the input vector.
   *
   * Produces:
   *   sorted, a vector
   * Pre:
   *   (1) c.compare can be applied to any two valid elements of v.
   * Post:
   *   (1) v has not changed.
   *   (2) sorted is a permutation of v.
   *   (3) c.compare(sorted.get(i), sorted.get(i+1)) <= 0 for
   *       all "reasonable" i.
   */
  public Vector sort(Comparator c, Vector v);
} // interface Sorter

