import java.io.*;
import javagently.*;
import myutilities.*;

class SortTest {

    /* The SortTest program    by J M Bishop Dec 1996
     * -----------------    Java 1.1 October 1997
     *                      revised August 2000
     * for sorting a table, of countries or integers.
     * Illustrates interfaces and
     * linking up to an independent sorter.
     */

    public static void main(String[] args) throws IOException {
      new SortTest ();
    }

    SortTest () throws IOException {
        Country t [] = new Country[10];
        String s;

        Stream in = new Stream ("Countries.data", Stream.READ);
        for (int i = 0; i < t.length; i++) {
            s = in.readString();
            t[i] = new Country(s);
        }

        System.out.println("Original");
        System.out.println("========");
        for (int i = 0; i < t.length; i++) {
            System.out.println(t[i]);
        }

        Sort.selectionSort(t, t.length);

        System.out.println();
        System.out.println("Sorted");
        System.out.println("======");
        for (int i = 0; i < t.length; i++) {
            System.out.println(t[i]);
        }
    }
}
