/* * Part of the exercises for lecture 2 */ public class RasmusVectorTester{ public static void main( String[] args ){ RasmusVector v = new RasmusVector(); //lin 7 System.out.println( "Sets v = RasmusVector()" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); System.out.println(); v.add( "string 0" ); //lin 16 v.add( "string 1" ); //lin 17 System.out.println( "Has called v.add(Object) twice" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); System.out.println(); v.add( "string 2" ); //lin 26 v.add( "string 3" ); //lin 27 v.add( "string 4" ); //lin 28 v.add( "string 5" ); //lin 29 System.out.println( "Has called v.add(Object) 4 times" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); System.out.println(); v.add( "string 6" ); //lin 38 v.add( "string 7" ); //lin 39 v.add( "string 8" ); //lin 40 v.add( "string 9" ); //lin 41 System.out.println( "Has called v.add(Object) 4 times" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); System.out.println(); v.remove( 2 ); //lin 50 System.out.println( "Has called v.remove(2)" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); System.out.println(); for( int n = 0; n < 5; n++ ){ v.remove( 1 ); } // lin 62 System.out.println( "Has called v.remove(1) 5 times" ); System.out.println( "Important methods on v gives the following results:" ); System.out.println( " v.toString() = " + v.toString() ); System.out.println( " v.size() = " + v.size() ); System.out.println( " v.capacity() = " + v.capacity() ); } }