/**
* The Class TestObjectList is a test class
*
* Informatik II - FS2009
* Uebungsserie 6, Aufgaben 2/3
*
* @author Philipp Bolliger
**/
class TestObjectList {
/*
* COMPLETE THE CODE WHERE NECESSARY
*
* AND
*
* INSERT YOUR COMMENTS!!!!!!!!!
*/
public static void main( String[] args ) {
ObjectList objlist1 = new ObjectList();
try {
//create a list of generic objects
objlist1.addFirst( new String( "Tamarindo" ) );
objlist1.addFirst( new Character( 'M' ) );
objlist1.addFirst( new Integer( 30 ) );
objlist1.addFirst( new Boolean(true) );
objlist1.addFirst( new Short( (short)2008 ) );
//EXERCISE 2b
//print the list created above using the toString() method
System.out.println(" Test for exercise 2b:");
//...
//ADD YOUR CODE HERE
//...
//EXERCISE 2c
//print the list using the toVerboseString() method
//...
//ADD YOUR CODE HERE
//...
//ADDITIONAL TESTS
//create a second list
ObjectList objlist2 = new ObjectList();
objlist2.addFirst( new Boolean(false) );
//add some other elements to this list
//...
//ADD YOUR CODE HERE
//...
//add this second list to the top of the first one
objlist1.addFirst( objlist2 );
//then print the obtained list in both non verbose and verbose mode
//print the list in non verbose mode
System.out.println(" Concatenated lists, non verbose mode:");
//...
//ADD YOUR CODE HERE
//...
//EXERCISE 3c
//create a new list
ObjectList objlist3 = new ObjectList();
//add Character elements to the new list
char[] myChars="Matrinique".toCharArray();
for(int i = myChars.length -1 ; i >= 0; i--) {
objlist3 .addFirst(new Character(myChars[i]));
}
//sort the list objlist3 and
//print both the unsorted and sorted list
//...
//ADD YOUR CODE HERE
//...
//EXERCISE 3d
ObjectList objlist4 = new ObjectList();
//create a list of 5 circles with random radii
//...
//ADD YOUR CODE HERE
//...
//and print both the unsorted and sorted lists
//...
//ADD YOUR CODE HERE
//...
//EXERCISE 3e
//add a Rectangle element to the list objlist4
//sort the list objlist 4
//and print both the sorted and unsorted lists
//...
//ADD YOUR CODE HERE
//...
} catch( Exception e ) {
e.printStackTrace();
}
} // end main()
} // end class TestObjectList