import java.util.concurrent.ThreadLocalRandom;

/**
 * Test program for the SortedList class.
 *
 * @author Drue Coles
 */
public class SortedListTester {

    public static void main(String[] args) {

        SortedList sortedList = new SortedList();       
        ThreadLocalRandom rand = ThreadLocalRandom.current();
        final int NUM_LINE_SEGMENTS = 10;
        for (int i = 0; i < NUM_LINE_SEGMENTS; i++) {
            // random coordinates for two endpoints
            double a = rand.nextDouble(0, 10);
            double b = rand.nextDouble(0, 10);
            double u = rand.nextDouble(0, 10);
            double v = rand.nextDouble(0, 10);
            sortedList.add(new LineSegment2(a, b, u, v));
        }

        // output contents of list to verify order
        for (int i = 0; i < sortedList.size(); i++) {
            System.out.println(sortedList.get(i));
        }
        System.out.println();
        
        // insert 3 network users into an empty list
        sortedList = new SortedList();
        NetworkUser2 n1 = new NetworkUser2("washington", "usa123");
        NetworkUser2 n2 = new NetworkUser2("adams", "july4hello");
        NetworkUser2 n3 = new NetworkUser2("jefferson", "virginia1743");
        NetworkUser2 n4 = new NetworkUser2("madison", "password");
        sortedList.add(n1);
        sortedList.add(n2);
        sortedList.add(n3);
        sortedList.add(n4);

        // output contents of list to verify order
        for (int i = 0; i < sortedList.size(); i++) {
            NetworkUser2 n = (NetworkUser2) sortedList.get(i);
            System.out.println(n.getLogin());
        }
        System.out.println();
    }
}