import java.io.*;

public class TestSCL {

    public static SCL leggiSCL (BufferedReader br) 
	                         throws SCLeccezione, IOException {
	SCL aux = new SCL ();
	String o = br.readLine();
	while (o != null){
	    aux.addElement(o);
	    o = br.readLine();
	}
	return aux;
    }

    public static SCL leggiavantiSCL (BufferedReader br) 
	                        throws SCLeccezione, IOException {
	String o = br.readLine();
	if (o == null) 
	    return new SCL ();
	else {
		SCL s = leggiavantiSCL(br);
		s.addElement(o);
		return s;
	    }
    }

    public static void main(String[] args) throws IOException, SCLeccezione {
	
	FileInputStream filein =
	    new FileInputStream (new File ("testSCL.txt"));
	BufferedReader br =
	    new BufferedReader(new InputStreamReader(filein));

	SCL l1 = leggiavantiSCL(br);
	System.out.println("\nLista letta da file");
	System.out.print("l1 = \n");
	l1.print();

//	System.out.println("\nInserisco X in posizione 5");
//	SCLFun l2 = l1.insertElementAt(5,"X");
//	System.out.print("l1 = ");
//	l1.printSCL();
//	System.out.print("l2 = ");
//	l2.printSCL();
	
//	System.out.println("\nRimuovo gli elementi in posizione 0 e 3");
//	SCLFun l3 = l2.removeElementAt(3).removeElementAt(0);
//	System.out.print("l1 = ");
//	l1.printSCL();
//	System.out.print("l2 = ");
//	l2.printSCL();
//	System.out.print("l3 = ");
//	l3.printSCL();

//	System.out.println("\nRimuovo gli elemento J e K");
//	SCLFun l4 = l3.removeElement("J").removeElement("K");
//	System.out.print("l3 = ");
//	l3.printSCL();
//	System.out.print("l4 = ");
//	l4.printSCL();

    }
}
