/*
 * Created on Jan 29, 2005
 *
 * Advanced Data Management Group
 * Center for Advanced Computing and Informatics Studies
 * University of Puerto Rico, Mayaguez
 * 
 */
package ece.uprm.admg.cs2.p1;

import ece.uprm.admg.cs2.util.*;

/**
 * @author Manuel Rodriguez
 *
 */
public class SetTester {

    public void start(){
        Set S1 = new DynamicSet();
        
        System.out.println("Adding Jil to S1");
        S1.add("Jil");
        System.out.println("Adding Bob to S1");
        S1.add("Bob");
        System.out.println("Adding Tom to S1");
        S1.add("Tom");
        System.out.println("Size of S1: " + S1.size());
        System.out.println("Elements in S1");
        ((DynamicSet) S1).print(System.out);
        
        System.out.println("Creating Set S2");
        Set S2 = new DynamicSet();
        System.out.println("Adding to S2 all of S1");
        S2.add(S1);
        System.out.println("Contents of S1:");
        ((DynamicSet)S1).print(System.out);
        System.out.println("Contents of S2:");
        ((DynamicSet)S2).print(System.out);
        System.out.println("Contents of the S1 - S2:");
        Set S3 = S1.difference(S2);
        ((DynamicSet)S3).print(System.out);
        System.out.println("Adding Ned to S1");
        S1.add("Ned");
        System.out.println("Adding Apu to S1");
        S1.add("Apu");
        System.out.println("Adding Joe to S2");
        S2.add("Joe");
        System.out.println("Printing S1: ");
        ((DynamicSet)S1).print(System.out);
        System.out.println("Printing S2: ");
        ((DynamicSet)S2).print(System.out);
        System.out.println("Printing S3 = S1 union S2");
        S3 = S1.union(S2);
        ((DynamicSet) S3).print(System.out);
        System.out.println("Printing S3 = S1 intersection S2");
        S3 = S1.intersection(S2);
        ((DynamicSet)S3).print(System.out);
        System.out.println("Printing S3 = S2 difference S1");
        S3 = S2.difference(S1);
        ((DynamicSet) S3).print(System.out);
        System.out.println("Done!");
                
    }
    
    public static void main(String[] args) {
        SetTester tester = new SetTester();
        
        try {
            tester.start();
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
}
