import IncomparableException; import StringComparator; import Quicksortable; import SimpleOutput; /** * A test of the Quicksortable class and the SimpleIntegerComparator. * Sorts integer values presented on the command line and then * prints them out. * * @author Samuel A. Rebelsky * @version 1.0 of October 1999 */ public class TestIQS { /** Do the testing. * * @exception IncomparableException * When the command line parameters are not all integers. */ public static void main(String[] args) throws IncomparableException { // Prepare for output. SimpleOutput out = new SimpleOutput(); // Convert the Strings to Integers. Since this is a test // program, we allow it to crash and burn if any of the // conversions fail. Integer[] ints = new Integer[args.length]; for (int i = 0; i < args.length; i++) { ints[i] = new Integer(args[i]); } // Build the array for sorting. NewQuicksortable stuff = new NewQuicksortable(ints); // Sort! stuff.sort(new SimpleIntegerComparator()); // And print it out. for (int i = 0; i < stuff.size(); ++i) { out.println(i + ": " + stuff.get(i)); } // for } // main(String[]) } // class TestIQS