Java programming homework

profileklassjin
hw4.given_.tar_.gz

Given/part5/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: created 149 Element created 11 EBoolean created 41 EInteger created 97 EString

Given/part5/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part5/Main.java

Given/part5/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/HWDesc

# HW description file # ######### reminder to staff: do NOT edit this file by hand. # it was generated automatically. # # HW=hw4 # format: # partN numRuns # +partN redirectOutput doDiff yourOutput correctOutput statusCorrect command part0 3 +part0 false false UNUSED UNUSED 0 make remake +part0 true true Output.your Output.correct 0 java Main +part0 false false UNUSED UNUSED 0 make clean part1 3 +part1 false false UNUSED UNUSED 0 make remake +part1 true true Output.your Output.correct 0 java Main +part1 false false UNUSED UNUSED 0 make clean part2 3 +part2 false false UNUSED UNUSED 0 make remake +part2 true true Output.your Output.correct 0 java Main +part2 false false UNUSED UNUSED 0 make clean part3 3 +part3 false false UNUSED UNUSED 0 make remake +part3 true true Output.your Output.correct 0 java Main +part3 false false UNUSED UNUSED 0 make clean part4 3 +part4 false false UNUSED UNUSED 0 make remake +part4 true true Output.your Output.correct 0 java Main +part4 false false UNUSED UNUSED 0 make clean part5 3 +part5 false false UNUSED UNUSED 0 make remake +part5 true true Output.your Output.correct 0 java Main +part5 false false UNUSED UNUSED 0 make clean part6 3 +part6 false false UNUSED UNUSED 0 make remake +part6 true true Output.your Output.correct 0 java Main +part6 false false UNUSED UNUSED 0 make clean part7 4 +part7 false false UNUSED UNUSED 0 make remake +part7 true true Output.your Output.correct 0 java Main +part7 true true Output.your1 Output.correct1 1 java Main EListIt +part7 false false UNUSED UNUSED 0 make clean part8 3 +part8 false false UNUSED UNUSED 0 make remake +part8 true true Output.your Output.correct 0 java Main +part8 false false UNUSED UNUSED 0 make clean part9 3 +part9 false false UNUSED UNUSED 0 make remake +part9 true true Output.your Output.correct 0 java Main +part9 false false UNUSED UNUSED 0 make clean

Given/part0/Element.java

Given/part0/Element.java

// the Element base class

public   abstract   class   Element   {
}

Given/part0/Output.correct

b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true:

Given/part0/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part0/Main.java

Given/part0/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . exit ( 0 );
     }
}

Given/part9/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: l1.capacity():2: l1.size():0: l1 ++++ ---- l1.capacity():2: l1.size():1: l1 ++++ 34 ---- l1.capacity():2: l1.size():2: l1 ++++ 34 $false$ ---- l2.capacity():2: l2.size():0: l2 ++++ ---- l2.capacity():2: l2.size():1: l2 ++++ abcdefghijklmnopqrstuvwx ---- l2.capacity():2: l2.size():2: l2 ++++ abcdefghijklmnopqrstuvwx abc ---- l1.capacity():4: l1.size():3: l1 ++++ 34 $false$ $true$ ---- l1.capacity():4: l1.size():4: l1 ++++ 34 $false$ $true$ 101 ---- l1.capacity():8: l1.size():5: l1 ++++ 34 $false$ $true$ 101 102 ---- l1.capacity():8: l1.size():6: l1 ++++ 34 $false$ $true$ 101 102 103 ---- l1.capacity():8: l1.size():7: l1 ++++ 34 $false$ $true$ 101 102 103 104 ---- l1.capacity():8: l1.size():8: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 ---- l1.capacity():16: l1.size():9: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 ---- l1.capacity():16: l1.size():10: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 ---- l1.capacity():16: l1.size():11: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 ---- l1.capacity():16: l1.size():12: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 ---- l1.capacity():16: l1.size():13: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 ---- l1.capacity():16: l1.size():14: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 ---- l1.capacity():16: l1.size():15: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 ---- l1.capacity():16: l1.size():16: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 ---- l1.capacity():32: l1.size():17: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 ---- l1.capacity():32: l1.size():18: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 ---- l1.capacity():32: l1.size():19: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ---- l1.capacity():32: l1.size():20: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 ---- l1.capacity():32: l1.size():21: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ---- l1.capacity():32: l1.size():22: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 ---- l3.capacity():2: l3.size():0: l3 ++++ ---- l3.capacity():16: l3.size():10: l3 ++++ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ ---- myprint(l1) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! myprint(l2) abcdefghijklmnopqrstuvwx!abc! myprint(l3) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! cross(l2, l2) abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abc abc abcdefghijklmnopqrstuvwx abc abc cross(l1, l2) 34 abcdefghijklmnopqrstuvwx 34 abc $false$ abcdefghijklmnopqrstuvwx $false$ abc $true$ abcdefghijklmnopqrstuvwx $true$ abc 101 abcdefghijklmnopqrstuvwx 101 abc 102 abcdefghijklmnopqrstuvwx 102 abc 103 abcdefghijklmnopqrstuvwx 103 abc 104 abcdefghijklmnopqrstuvwx 104 abc 105 abcdefghijklmnopqrstuvwx 105 abc 106 abcdefghijklmnopqrstuvwx 106 abc 107 abcdefghijklmnopqrstuvwx 107 abc 108 abcdefghijklmnopqrstuvwx 108 abc 109 abcdefghijklmnopqrstuvwx 109 abc 110 abcdefghijklmnopqrstuvwx 110 abc 111 abcdefghijklmnopqrstuvwx 111 abc 112 abcdefghijklmnopqrstuvwx 112 abc 113 abcdefghijklmnopqrstuvwx 113 abc 114 abcdefghijklmnopqrstuvwx 114 abc 115 abcdefghijklmnopqrstuvwx 115 abc 116 abcdefghijklmnopqrstuvwx 116 abc 117 abcdefghijklmnopqrstuvwx 117 abc 118 abcdefghijklmnopqrstuvwx 118 abc 119 abcdefghijklmnopqrstuvwx 119 abc cross(l2, l1) abcdefghijklmnopqrstuvwx 34 abcdefghijklmnopqrstuvwx $false$ abcdefghijklmnopqrstuvwx $true$ abcdefghijklmnopqrstuvwx 101 abcdefghijklmnopqrstuvwx 102 abcdefghijklmnopqrstuvwx 103 abcdefghijklmnopqrstuvwx 104 abcdefghijklmnopqrstuvwx 105 abcdefghijklmnopqrstuvwx 106 abcdefghijklmnopqrstuvwx 107 abcdefghijklmnopqrstuvwx 108 abcdefghijklmnopqrstuvwx 109 abcdefghijklmnopqrstuvwx 110 abcdefghijklmnopqrstuvwx 111 abcdefghijklmnopqrstuvwx 112 abcdefghijklmnopqrstuvwx 113 abcdefghijklmnopqrstuvwx 114 abcdefghijklmnopqrstuvwx 115 abcdefghijklmnopqrstuvwx 116 abcdefghijklmnopqrstuvwx 117 abcdefghijklmnopqrstuvwx 118 abcdefghijklmnopqrstuvwx 119 abc 34 abc $false$ abc $true$ abc 101 abc 102 abc 103 abc 104 abc 105 abc 106 abc 107 abc 108 abc 109 abc 110 abc 111 abc 112 abc 113 abc 114 abc 115 abc 116 abc 117 abc 118 abc 119 cross(l1, l3) 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $false$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $false$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $false$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $false$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $false$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $false$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $false$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $false$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $false$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $false$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $false$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $false$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $false$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $false$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $false$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $false$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $false$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $false$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $false$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $false$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ cross(l3, l1) $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 cross(l1, l1) 34 34 34 $false$ 34 $true$ 34 101 34 102 34 103 34 104 34 105 34 106 34 107 34 108 34 109 34 110 34 111 34 112 34 113 34 114 34 115 34 116 34 117 34 118 34 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 101 34 101 $false$ 101 $true$ 101 101 101 102 101 103 101 104 101 105 101 106 101 107 101 108 101 109 101 110 101 111 101 112 101 113 101 114 101 115 101 116 101 117 101 118 101 119 102 34 102 $false$ 102 $true$ 102 101 102 102 102 103 102 104 102 105 102 106 102 107 102 108 102 109 102 110 102 111 102 112 102 113 102 114 102 115 102 116 102 117 102 118 102 119 103 34 103 $false$ 103 $true$ 103 101 103 102 103 103 103 104 103 105 103 106 103 107 103 108 103 109 103 110 103 111 103 112 103 113 103 114 103 115 103 116 103 117 103 118 103 119 104 34 104 $false$ 104 $true$ 104 101 104 102 104 103 104 104 104 105 104 106 104 107 104 108 104 109 104 110 104 111 104 112 104 113 104 114 104 115 104 116 104 117 104 118 104 119 105 34 105 $false$ 105 $true$ 105 101 105 102 105 103 105 104 105 105 105 106 105 107 105 108 105 109 105 110 105 111 105 112 105 113 105 114 105 115 105 116 105 117 105 118 105 119 106 34 106 $false$ 106 $true$ 106 101 106 102 106 103 106 104 106 105 106 106 106 107 106 108 106 109 106 110 106 111 106 112 106 113 106 114 106 115 106 116 106 117 106 118 106 119 107 34 107 $false$ 107 $true$ 107 101 107 102 107 103 107 104 107 105 107 106 107 107 107 108 107 109 107 110 107 111 107 112 107 113 107 114 107 115 107 116 107 117 107 118 107 119 108 34 108 $false$ 108 $true$ 108 101 108 102 108 103 108 104 108 105 108 106 108 107 108 108 108 109 108 110 108 111 108 112 108 113 108 114 108 115 108 116 108 117 108 118 108 119 109 34 109 $false$ 109 $true$ 109 101 109 102 109 103 109 104 109 105 109 106 109 107 109 108 109 109 109 110 109 111 109 112 109 113 109 114 109 115 109 116 109 117 109 118 109 119 110 34 110 $false$ 110 $true$ 110 101 110 102 110 103 110 104 110 105 110 106 110 107 110 108 110 109 110 110 110 111 110 112 110 113 110 114 110 115 110 116 110 117 110 118 110 119 111 34 111 $false$ 111 $true$ 111 101 111 102 111 103 111 104 111 105 111 106 111 107 111 108 111 109 111 110 111 111 111 112 111 113 111 114 111 115 111 116 111 117 111 118 111 119 112 34 112 $false$ 112 $true$ 112 101 112 102 112 103 112 104 112 105 112 106 112 107 112 108 112 109 112 110 112 111 112 112 112 113 112 114 112 115 112 116 112 117 112 118 112 119 113 34 113 $false$ 113 $true$ 113 101 113 102 113 103 113 104 113 105 113 106 113 107 113 108 113 109 113 110 113 111 113 112 113 113 113 114 113 115 113 116 113 117 113 118 113 119 114 34 114 $false$ 114 $true$ 114 101 114 102 114 103 114 104 114 105 114 106 114 107 114 108 114 109 114 110 114 111 114 112 114 113 114 114 114 115 114 116 114 117 114 118 114 119 115 34 115 $false$ 115 $true$ 115 101 115 102 115 103 115 104 115 105 115 106 115 107 115 108 115 109 115 110 115 111 115 112 115 113 115 114 115 115 115 116 115 117 115 118 115 119 116 34 116 $false$ 116 $true$ 116 101 116 102 116 103 116 104 116 105 116 106 116 107 116 108 116 109 116 110 116 111 116 112 116 113 116 114 116 115 116 116 116 117 116 118 116 119 117 34 117 $false$ 117 $true$ 117 101 117 102 117 103 117 104 117 105 117 106 117 107 117 108 117 109 117 110 117 111 117 112 117 113 117 114 117 115 117 116 117 117 117 118 117 119 118 34 118 $false$ 118 $true$ 118 101 118 102 118 103 118 104 118 105 118 106 118 107 118 108 118 109 118 110 118 111 118 112 118 113 118 114 118 115 118 116 118 117 118 118 118 119 119 34 119 $false$ 119 $true$ 119 101 119 102 119 103 119 104 119 105 119 106 119 107 119 108 119 109 119 110 119 111 119 112 119 113 119 114 119 115 119 116 119 117 119 118 119 119 cross(l3, l3) $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ noSideEffects(new EList()) myprint(l) l.size():0: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l1) myprint(l) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! l.size():22: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():34: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$false$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: noSideEffects(l2) myprint(l) abcdefghijklmnopqrstuvwx!abc! l.size():2: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abcdefghijklmnopqrstuvwx: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abc: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l3) myprint(l) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! l.size():10: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: test of calling EListIt too many times ei.next():61: ei.next():63: ei.next():62: = caught UsingIteratorPastEndException from EListIt EListUser.size1(new EList()):0: EListUser.size1(l1):22: EListUser.size1(l2):2: EListUser.size1(l3):10: EListUser.size2(new EList()):0: EListUser.size2(l1):22: EListUser.size2(l2):2: EListUser.size2(l3):10: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(l1):false: EListUser.isBalanced(l2):true: EListUser.isBalanced(l3):true: myprintS(a1) /*unsorted*/ Hi Mom Dad myprintS(a1) /*sorted*/ Dad Hi Mom myprintB(c1) /*unsorted*/ $true$ $false$ $true$ myprintB(c1) /*sorted*/ $false$ $true$ $true$ myprintI(d1) /*unsorted*/ 3 0 99 myprintI(d1) /*sorted*/ 0 3 99 myprintI(g1) /*unsorted*/ 3 -53 0 99 -8 myprintI(g1) /*sorted reverse*/ 99 3 0 -8 -53 myprintE(h1) /*unsorted*/ zebra 3 -53 hello 0 $false$ there 99 $true$ -8 $false$ myprintE(h1) /*sorted*/ $false$ $false$ $true$ -53 -8 0 3 99 hello there zebra created 196 Element created 17 EBoolean created 76 EInteger created 103 EString

Given/part9/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part9/EIntegerReverseComparator.java

Given/part9/EIntegerReverseComparator.java

// this skeleton is so you can translate and run previous subparts
// before you work on this subpart.

import  java . util . Comparator ;

public   class   EIntegerReverseComparator   implements   Comparator < EInteger >   {

     public   int  compare ( EInteger  e1 ,   EInteger  e2 )   {
     return   0 ;
      }

}

Given/part9/Main.java

Given/part9/Main.java

/* *** This file is given as part of the programming assignment. *** */
import  java . util . * ;
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // list stuff
         EList  l1  =   new   EList ();
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( i1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( b2 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         EList  l2  =   new   EList ();
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s4 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s1 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l1 . add ( b1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         for   ( int  k  =   101 ;  k  <   120 ;  k ++ )   {
            l1 . add ( new   EInteger ( k ));
             System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
             System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
             System . out . println (   "l1"   );  
              System . out . println ( l1 );
         }
         EList  l3  =   new   EList ();
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b2 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
         // test iterators
         System . out . println (   "myprint(l1)"   );  
             myprint ( l1 );
         System . out . println (   "myprint(l2)"   );  
             myprint ( l2 );
         System . out . println (   "myprint(l3)"   );  
             myprint ( l3 );
         System . out . println (   "cross(l2, l2)"   );  
             cross ( l2 ,  l2 );
         System . out . println (   "cross(l1, l2)"   );  
             cross ( l1 ,  l2 );
         System . out . println (   "cross(l2, l1)"   );  
             cross ( l2 ,  l1 );
         System . out . println (   "cross(l1, l3)"   );  
             cross ( l1 ,  l3 );
         System . out . println (   "cross(l3, l1)"   );  
             cross ( l3 ,  l1 );
         System . out . println (   "cross(l1, l1)"   );  
             cross ( l1 ,  l1 );
         System . out . println (   "cross(l3, l3)"   );  
             cross ( l3 ,  l3 );
         System . out . println (   "noSideEffects(new EList())"   );  
             noSideEffects ( new   EList ());
         System . out . println (   "noSideEffects(l1)"   );  
             noSideEffects ( l1 );
         System . out . println (   "noSideEffects(l2)"   );  
             noSideEffects ( l2 );
         System . out . println (   "noSideEffects(l3)"   );  
             noSideEffects ( l3 );
  try   {
             System . out . println ( "test of calling EListIt"
                   + " too many times" );
             EList  el  =   new   EList ();
     el . add ( new   EInteger ( 61 ));
     el . add ( new   EInteger ( 63 ));
     el . add ( new   EInteger ( 62 ));
             EListIt  ei  =  el . iterator ();
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
  }
         catch   ( UsingIteratorPastEndException  e )   {
             System . out . println ( "= caught UsingIteratorPastEndException from EListIt" );
  }
  System . out . println (   "EListUser.size1(new EList())"   +   ":"   +   ( EListUser . size1 ( new   EList ()))   +   ":" );
  System . out . println (   "EListUser.size1(l1)"   +   ":"   +   ( EListUser . size1 ( l1 ))   +   ":" );
  System . out . println (   "EListUser.size1(l2)"   +   ":"   +   ( EListUser . size1 ( l2 ))   +   ":" );
  System . out . println (   "EListUser.size1(l3)"   +   ":"   +   ( EListUser . size1 ( l3 ))   +   ":" );
  System . out . println (   "EListUser.size2(new EList())"   +   ":"   +   ( EListUser . size2 ( new   EList ()))   +   ":" );
  System . out . println (   "EListUser.size2(l1)"   +   ":"   +   ( EListUser . size2 ( l1 ))   +   ":" );
  System . out . println (   "EListUser.size2(l2)"   +   ":"   +   ( EListUser . size2 ( l2 ))   +   ":" );
  System . out . println (   "EListUser.size2(l3)"   +   ":"   +   ( EListUser . size2 ( l3 ))   +   ":" );
  {
         EList  k0  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
         EList  k1  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s3 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
         EList  k2  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l1)"   +   ":"   +   ( EListUser . isBalanced ( l1 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l2)"   +   ":"   +   ( EListUser . isBalanced ( l2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l3)"   +   ":"   +   ( EListUser . isBalanced ( l3 ))   +   ":" );
  }
         ArrayList < EString >  a1  =   new   ArrayList < EString > ();
 a1 . add ( new   EString ( "Hi" ));
 a1 . add ( new   EString ( "Mom" ));
 a1 . add ( new   EString ( "Dad" ));
  System . out . println (   "myprintS(a1) /*unsorted*/"   );  
             myprintS ( a1 )   /*unsorted*/ ;
         Collections . sort ( a1 );
  System . out . println (   "myprintS(a1) /*sorted*/"   );  
             myprintS ( a1 )   /*sorted*/ ;
         ArrayList < EBoolean >  c1  =   new   ArrayList < EBoolean > ();
 c1 . add ( new   EBoolean ( 3 ));
 c1 . add ( new   EBoolean ( 0 ));
 c1 . add ( new   EBoolean ( 99 ));
  System . out . println (   "myprintB(c1) /*unsorted*/"   );  
             myprintB ( c1 )   /*unsorted*/ ;
         Collections . sort ( c1 );
  System . out . println (   "myprintB(c1) /*sorted*/"   );  
             myprintB ( c1 )   /*sorted*/ ;
         ArrayList < EInteger >  d1  =   new   ArrayList < EInteger > ();
 d1 . add ( new   EInteger ( 3 ));
 d1 . add ( new   EInteger ( 0 ));
 d1 . add ( new   EInteger ( 99 ));
  System . out . println (   "myprintI(d1) /*unsorted*/"   );  
             myprintI ( d1 )   /*unsorted*/ ;
         Collections . sort ( d1 );
  System . out . println (   "myprintI(d1) /*sorted*/"   );  
             myprintI ( d1 )   /*sorted*/ ;
         ArrayList < EInteger >  g1  =   new   ArrayList < EInteger > ();
 g1 . add ( new   EInteger ( 3 ));
 g1 . add ( new   EInteger ( - 53 ));
 g1 . add ( new   EInteger ( 0 ));
 g1 . add ( new   EInteger ( 99 ));
 g1 . add ( new   EInteger ( - 8 ));
  System . out . println (   "myprintI(g1) /*unsorted*/"   );  
             myprintI ( g1 )   /*unsorted*/ ;
         Collections . sort ( g1 ,   new   EIntegerReverseComparator ());
  System . out . println (   "myprintI(g1) /*sorted reverse*/"   );  
             myprintI ( g1 )   /*sorted reverse*/ ;
         ArrayList < Element >  h1  =   new   ArrayList < Element > ();
 h1 . add ( new   EString ( "zebra" ));
 h1 . add ( new   EInteger ( 3 ));
 h1 . add ( new   EInteger ( - 53 ));
 h1 . add ( new   EString ( "hello" ));
 h1 . add ( new   EInteger ( 0 ));
 h1 . add ( new   EBoolean ( 0 ));
 h1 . add ( new   EString ( "there" ));
 h1 . add ( new   EInteger ( 99 ));
 h1 . add ( new   EBoolean ( 99 ));
 h1 . add ( new   EInteger ( - 8 ));
 h1 . add ( new   EBoolean ( 0 ));
  System . out . println (   "myprintE(h1) /*unsorted*/"   );  
             myprintE ( h1 )   /*unsorted*/ ;
         Collections . sort ( h1 ,   new   ElementComparator ());
  System . out . println (   "myprintE(h1) /*sorted*/"   );  
             myprintE ( h1 )   /*sorted*/ ;
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  myprintE ( ArrayList < Element >  l )   {
  for   ( Element  e :  l )   {
       System . out . println ( e );
         }
     }
     private   static   void  myprintB ( ArrayList < EBoolean >  l )   {
  for   ( EBoolean  e :  l )   {
       System . out . println ( e );
         }
     }
     private   static   void  myprintI ( ArrayList < EInteger >  l )   {
  for   ( EInteger  e :  l )   {
       System . out . println ( e );
         }
     }
     private   static   void  myprintS ( ArrayList < EString >  l )   {
  for   ( EString  e :  l )   {
       System . out . println ( e );
         }
     }
     private   static   void  myprint ( EList  l )   {
         Element  e ;
         EListIt  t  =  l . iterator ();
         while   (  t . hasNext ()   )   {
      try   {
                 System . out . print ( t . next () + "!" );
      }
             catch   ( UsingIteratorPastEndException  ee )   {
                 System . out . println ( "myprint oops! caught UsingIteratorPastEndException" );
             }
         }
         System . out . println ();
     }
     private   static   void  cross ( EList  l1 ,   EList  l2 )   {
         EListIt  t1  =  l1 . iterator ();
         while   (  t1 . hasNext ()   )   {
      try   {
                 Element  e1  =  t1 . next ();
                 EListIt  t2  =  l2 . iterator ();
                 while   (  t2 . hasNext ()   )   {
                      System . out . println ( "    "   +  e1  +   " "   +  t2 . next ()   );
                 }
      }
             catch   ( UsingIteratorPastEndException  e )   {
                 System . out . println ( "cross oops! caught UsingIteratorPastEndException" );
             }
         }
     }
     // check that hasNext has no side effects.
     // this entire test uses a single iterator.
     // each "run" calls hasNext HN times
     // before printing out the next element (if there is one).
     // test w/ (at least) lists of size=0, 0<size<HN, size>HN*RUNS.
     private   static   void  noSideEffects ( EList  l )   {
  final   int  RUNS  =   3 ;
  final   int  HN  =   4 ;
         System . out . println (   "myprint(l)"   );  
             myprint ( l );
  System . out . println (   "l.size()"   +   ":"   +   ( l . size ())   +   ":" );
         EListIt  t  =  l . iterator ();
  for   ( int  run  =   1 ;  run  <=  RUNS ;  run ++ )   {
      for   ( int  k  =   1 ;  k  <=  HN ;  k ++ )   {
          System . out . println (   "t.hasNext()"   +   ":"   +   ( t . hasNext ())   +   ":" );
      }
      if   (  t . hasNext ()   )   {
          try   {
                     System . out . println (   "t.next()"   +   ":"   +   ( t . next ())   +   ":" );
          }
                 catch   ( UsingIteratorPastEndException  e )   {
                     System . out . println ( "noSideEffects oops! caught UsingIteratorPastEndException" );
                 }
       }
  }
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/part9/ElementComparator.java

Given/part9/ElementComparator.java

// this skeleton is so you can translate and run previous subparts
// before you work on this subpart.

import  java . util . Comparator ;

public   class   ElementComparator   implements   Comparator < Element >   {

     public   int  compare ( Element  e1 ,   Element  e2 )   {
         return   0 ;
     }

}

Given/part4/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: created 149 Element created 11 EBoolean created 41 EInteger created 97 EString

Given/part4/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part4/Main.java

Given/part4/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( (EString)Plus.plus( (EInteger)Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   ( EString ) Plus . plus (   ( EInteger ) Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/part2/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: created 11 Element created 2 EBoolean created 4 EInteger created 5 EString

Given/part2/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part2/Main.java

Given/part2/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/part7/Output.correct1

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString test of calling EListIt too many times ei.next():61: ei.next():63: ei.next():62: EListIt called past end

Given/part7/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: l1.capacity():2: l1.size():0: l1 ++++ ---- l1.capacity():2: l1.size():1: l1 ++++ 34 ---- l1.capacity():2: l1.size():2: l1 ++++ 34 $false$ ---- l2.capacity():2: l2.size():0: l2 ++++ ---- l2.capacity():2: l2.size():1: l2 ++++ abcdefghijklmnopqrstuvwx ---- l2.capacity():2: l2.size():2: l2 ++++ abcdefghijklmnopqrstuvwx abc ---- l1.capacity():4: l1.size():3: l1 ++++ 34 $false$ $true$ ---- l1.capacity():4: l1.size():4: l1 ++++ 34 $false$ $true$ 101 ---- l1.capacity():8: l1.size():5: l1 ++++ 34 $false$ $true$ 101 102 ---- l1.capacity():8: l1.size():6: l1 ++++ 34 $false$ $true$ 101 102 103 ---- l1.capacity():8: l1.size():7: l1 ++++ 34 $false$ $true$ 101 102 103 104 ---- l1.capacity():8: l1.size():8: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 ---- l1.capacity():16: l1.size():9: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 ---- l1.capacity():16: l1.size():10: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 ---- l1.capacity():16: l1.size():11: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 ---- l1.capacity():16: l1.size():12: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 ---- l1.capacity():16: l1.size():13: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 ---- l1.capacity():16: l1.size():14: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 ---- l1.capacity():16: l1.size():15: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 ---- l1.capacity():16: l1.size():16: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 ---- l1.capacity():32: l1.size():17: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 ---- l1.capacity():32: l1.size():18: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 ---- l1.capacity():32: l1.size():19: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ---- l1.capacity():32: l1.size():20: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 ---- l1.capacity():32: l1.size():21: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ---- l1.capacity():32: l1.size():22: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 ---- l3.capacity():2: l3.size():0: l3 ++++ ---- l3.capacity():16: l3.size():10: l3 ++++ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ ---- myprint(l1) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! myprint(l2) abcdefghijklmnopqrstuvwx!abc! myprint(l3) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! cross(l2, l2) abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abc abc abcdefghijklmnopqrstuvwx abc abc cross(l1, l2) 34 abcdefghijklmnopqrstuvwx 34 abc $false$ abcdefghijklmnopqrstuvwx $false$ abc $true$ abcdefghijklmnopqrstuvwx $true$ abc 101 abcdefghijklmnopqrstuvwx 101 abc 102 abcdefghijklmnopqrstuvwx 102 abc 103 abcdefghijklmnopqrstuvwx 103 abc 104 abcdefghijklmnopqrstuvwx 104 abc 105 abcdefghijklmnopqrstuvwx 105 abc 106 abcdefghijklmnopqrstuvwx 106 abc 107 abcdefghijklmnopqrstuvwx 107 abc 108 abcdefghijklmnopqrstuvwx 108 abc 109 abcdefghijklmnopqrstuvwx 109 abc 110 abcdefghijklmnopqrstuvwx 110 abc 111 abcdefghijklmnopqrstuvwx 111 abc 112 abcdefghijklmnopqrstuvwx 112 abc 113 abcdefghijklmnopqrstuvwx 113 abc 114 abcdefghijklmnopqrstuvwx 114 abc 115 abcdefghijklmnopqrstuvwx 115 abc 116 abcdefghijklmnopqrstuvwx 116 abc 117 abcdefghijklmnopqrstuvwx 117 abc 118 abcdefghijklmnopqrstuvwx 118 abc 119 abcdefghijklmnopqrstuvwx 119 abc cross(l2, l1) abcdefghijklmnopqrstuvwx 34 abcdefghijklmnopqrstuvwx $false$ abcdefghijklmnopqrstuvwx $true$ abcdefghijklmnopqrstuvwx 101 abcdefghijklmnopqrstuvwx 102 abcdefghijklmnopqrstuvwx 103 abcdefghijklmnopqrstuvwx 104 abcdefghijklmnopqrstuvwx 105 abcdefghijklmnopqrstuvwx 106 abcdefghijklmnopqrstuvwx 107 abcdefghijklmnopqrstuvwx 108 abcdefghijklmnopqrstuvwx 109 abcdefghijklmnopqrstuvwx 110 abcdefghijklmnopqrstuvwx 111 abcdefghijklmnopqrstuvwx 112 abcdefghijklmnopqrstuvwx 113 abcdefghijklmnopqrstuvwx 114 abcdefghijklmnopqrstuvwx 115 abcdefghijklmnopqrstuvwx 116 abcdefghijklmnopqrstuvwx 117 abcdefghijklmnopqrstuvwx 118 abcdefghijklmnopqrstuvwx 119 abc 34 abc $false$ abc $true$ abc 101 abc 102 abc 103 abc 104 abc 105 abc 106 abc 107 abc 108 abc 109 abc 110 abc 111 abc 112 abc 113 abc 114 abc 115 abc 116 abc 117 abc 118 abc 119 cross(l1, l3) 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $false$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $false$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $false$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $false$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $false$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $false$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $false$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $false$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $false$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $false$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $false$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $false$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $false$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $false$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $false$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $false$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $false$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $false$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $false$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $false$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ cross(l3, l1) $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 cross(l1, l1) 34 34 34 $false$ 34 $true$ 34 101 34 102 34 103 34 104 34 105 34 106 34 107 34 108 34 109 34 110 34 111 34 112 34 113 34 114 34 115 34 116 34 117 34 118 34 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 101 34 101 $false$ 101 $true$ 101 101 101 102 101 103 101 104 101 105 101 106 101 107 101 108 101 109 101 110 101 111 101 112 101 113 101 114 101 115 101 116 101 117 101 118 101 119 102 34 102 $false$ 102 $true$ 102 101 102 102 102 103 102 104 102 105 102 106 102 107 102 108 102 109 102 110 102 111 102 112 102 113 102 114 102 115 102 116 102 117 102 118 102 119 103 34 103 $false$ 103 $true$ 103 101 103 102 103 103 103 104 103 105 103 106 103 107 103 108 103 109 103 110 103 111 103 112 103 113 103 114 103 115 103 116 103 117 103 118 103 119 104 34 104 $false$ 104 $true$ 104 101 104 102 104 103 104 104 104 105 104 106 104 107 104 108 104 109 104 110 104 111 104 112 104 113 104 114 104 115 104 116 104 117 104 118 104 119 105 34 105 $false$ 105 $true$ 105 101 105 102 105 103 105 104 105 105 105 106 105 107 105 108 105 109 105 110 105 111 105 112 105 113 105 114 105 115 105 116 105 117 105 118 105 119 106 34 106 $false$ 106 $true$ 106 101 106 102 106 103 106 104 106 105 106 106 106 107 106 108 106 109 106 110 106 111 106 112 106 113 106 114 106 115 106 116 106 117 106 118 106 119 107 34 107 $false$ 107 $true$ 107 101 107 102 107 103 107 104 107 105 107 106 107 107 107 108 107 109 107 110 107 111 107 112 107 113 107 114 107 115 107 116 107 117 107 118 107 119 108 34 108 $false$ 108 $true$ 108 101 108 102 108 103 108 104 108 105 108 106 108 107 108 108 108 109 108 110 108 111 108 112 108 113 108 114 108 115 108 116 108 117 108 118 108 119 109 34 109 $false$ 109 $true$ 109 101 109 102 109 103 109 104 109 105 109 106 109 107 109 108 109 109 109 110 109 111 109 112 109 113 109 114 109 115 109 116 109 117 109 118 109 119 110 34 110 $false$ 110 $true$ 110 101 110 102 110 103 110 104 110 105 110 106 110 107 110 108 110 109 110 110 110 111 110 112 110 113 110 114 110 115 110 116 110 117 110 118 110 119 111 34 111 $false$ 111 $true$ 111 101 111 102 111 103 111 104 111 105 111 106 111 107 111 108 111 109 111 110 111 111 111 112 111 113 111 114 111 115 111 116 111 117 111 118 111 119 112 34 112 $false$ 112 $true$ 112 101 112 102 112 103 112 104 112 105 112 106 112 107 112 108 112 109 112 110 112 111 112 112 112 113 112 114 112 115 112 116 112 117 112 118 112 119 113 34 113 $false$ 113 $true$ 113 101 113 102 113 103 113 104 113 105 113 106 113 107 113 108 113 109 113 110 113 111 113 112 113 113 113 114 113 115 113 116 113 117 113 118 113 119 114 34 114 $false$ 114 $true$ 114 101 114 102 114 103 114 104 114 105 114 106 114 107 114 108 114 109 114 110 114 111 114 112 114 113 114 114 114 115 114 116 114 117 114 118 114 119 115 34 115 $false$ 115 $true$ 115 101 115 102 115 103 115 104 115 105 115 106 115 107 115 108 115 109 115 110 115 111 115 112 115 113 115 114 115 115 115 116 115 117 115 118 115 119 116 34 116 $false$ 116 $true$ 116 101 116 102 116 103 116 104 116 105 116 106 116 107 116 108 116 109 116 110 116 111 116 112 116 113 116 114 116 115 116 116 116 117 116 118 116 119 117 34 117 $false$ 117 $true$ 117 101 117 102 117 103 117 104 117 105 117 106 117 107 117 108 117 109 117 110 117 111 117 112 117 113 117 114 117 115 117 116 117 117 117 118 117 119 118 34 118 $false$ 118 $true$ 118 101 118 102 118 103 118 104 118 105 118 106 118 107 118 108 118 109 118 110 118 111 118 112 118 113 118 114 118 115 118 116 118 117 118 118 118 119 119 34 119 $false$ 119 $true$ 119 101 119 102 119 103 119 104 119 105 119 106 119 107 119 108 119 109 119 110 119 111 119 112 119 113 119 114 119 115 119 116 119 117 119 118 119 119 cross(l3, l3) $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ noSideEffects(new EList()) myprint(l) l.size():0: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l1) myprint(l) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! l.size():22: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():34: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$false$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: noSideEffects(l2) myprint(l) abcdefghijklmnopqrstuvwx!abc! l.size():2: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abcdefghijklmnopqrstuvwx: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abc: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l3) myprint(l) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! l.size():10: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: EListUser.size1(new EList()):0: EListUser.size1(l1):22: EListUser.size1(l2):2: EListUser.size1(l3):10: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(l1):false: EListUser.isBalanced(l2):true: EListUser.isBalanced(l3):true: created 168 Element created 11 EBoolean created 60 EInteger created 97 EString

Given/part7/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part7/Main.java

Given/part7/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         if (  args . length  >   0   )   {
                 System . out . println ( "test of calling " + args [ 0 ]
                       + " too many times" );
                 if (  args [ 0 ]. equals ( "EListIt" )   )   {
                     EList  el  =   new   EList ();
      el . add ( new   EInteger ( 61 ));
      el . add ( new   EInteger ( 63 ));
      el . add ( new   EInteger ( 62 ));
                     EListIt  ei  =  el . iterator ();
                     System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
                     System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
                     System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
                     System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
                     System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
                 }
                 else   {
                     System . err . println ( "args[0] Oops " + args [ 0 ]);
                     System . exit ( 3 );
                 }
                 System . exit ( 2 );   // should exit before this one.
         }
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // list stuff
         EList  l1  =   new   EList ();
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( i1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( b2 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         EList  l2  =   new   EList ();
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s4 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s1 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l1 . add ( b1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         for   ( int  k  =   101 ;  k  <   120 ;  k ++ )   {
            l1 . add ( new   EInteger ( k ));
             System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
             System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
             System . out . println (   "l1"   );  
              System . out . println ( l1 );
         }
         EList  l3  =   new   EList ();
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b2 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
         // test iterators
         System . out . println (   "myprint(l1)"   );  
             myprint ( l1 );
         System . out . println (   "myprint(l2)"   );  
             myprint ( l2 );
         System . out . println (   "myprint(l3)"   );  
             myprint ( l3 );
         System . out . println (   "cross(l2, l2)"   );  
             cross ( l2 ,  l2 );
         System . out . println (   "cross(l1, l2)"   );  
             cross ( l1 ,  l2 );
         System . out . println (   "cross(l2, l1)"   );  
             cross ( l2 ,  l1 );
         System . out . println (   "cross(l1, l3)"   );  
             cross ( l1 ,  l3 );
         System . out . println (   "cross(l3, l1)"   );  
             cross ( l3 ,  l1 );
         System . out . println (   "cross(l1, l1)"   );  
             cross ( l1 ,  l1 );
         System . out . println (   "cross(l3, l3)"   );  
             cross ( l3 ,  l3 );
         System . out . println (   "noSideEffects(new EList())"   );  
             noSideEffects ( new   EList ());
         System . out . println (   "noSideEffects(l1)"   );  
             noSideEffects ( l1 );
         System . out . println (   "noSideEffects(l2)"   );  
             noSideEffects ( l2 );
         System . out . println (   "noSideEffects(l3)"   );  
             noSideEffects ( l3 );
  System . out . println (   "EListUser.size1(new EList())"   +   ":"   +   ( EListUser . size1 ( new   EList ()))   +   ":" );
  System . out . println (   "EListUser.size1(l1)"   +   ":"   +   ( EListUser . size1 ( l1 ))   +   ":" );
  System . out . println (   "EListUser.size1(l2)"   +   ":"   +   ( EListUser . size1 ( l2 ))   +   ":" );
  System . out . println (   "EListUser.size1(l3)"   +   ":"   +   ( EListUser . size1 ( l3 ))   +   ":" );
  {
         EList  k0  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
         EList  k1  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s3 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
         EList  k2  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l1)"   +   ":"   +   ( EListUser . isBalanced ( l1 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l2)"   +   ":"   +   ( EListUser . isBalanced ( l2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l3)"   +   ":"   +   ( EListUser . isBalanced ( l3 ))   +   ":" );
  }
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  myprint ( EList  l )   {
         Element  e ;
         EListIt  t  =  l . iterator ();
         while   (  t . hasNext ()   )   {
             System . out . print ( t . next () + "!" );
         }
         System . out . println ();
     }
     private   static   void  cross ( EList  l1 ,   EList  l2 )   {
         EListIt  t1  =  l1 . iterator ();
         while   (  t1 . hasNext ()   )   {
             Element  e1  =  t1 . next ();
             EListIt  t2  =  l2 . iterator ();
             while   (  t2 . hasNext ()   )   {
                 System . out . println ( "    "   +  e1  +   " "   +  t2 . next ()   );
             }
         }
     }
     // check that hasNext has no side effects.
     // this entire test uses a single iterator.
     // each "run" calls hasNext HN times
     // before printing out the next element (if there is one).
     // test w/ (at least) lists of size=0, 0<size<HN, size>HN*RUNS.
     private   static   void  noSideEffects ( EList  l )   {
  final   int  RUNS  =   3 ;
  final   int  HN  =   4 ;
         System . out . println (   "myprint(l)"   );  
             myprint ( l );
  System . out . println (   "l.size()"   +   ":"   +   ( l . size ())   +   ":" );
         EListIt  t  =  l . iterator ();
  for   ( int  run  =   1 ;  run  <=  RUNS ;  run ++ )   {
      for   ( int  k  =   1 ;  k  <=  HN ;  k ++ )   {
          System . out . println (   "t.hasNext()"   +   ":"   +   ( t . hasNext ())   +   ":" );
      }
      if   (  t . hasNext ()   )   {
                 System . out . println (   "t.next()"   +   ":"   +   ( t . next ())   +   ":" );
       }
  }
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/tester

#!/bin/bash # ECS14A program testing tool # Copyright 2016 by Ronald A. Olsson # # Permission is granted only to use this code and its related files for # its intended purpose of testing programming assignments in Olsson's # ECS140A class at UC Davis. # Any other usage, without explicit written permission from Olsson, # is not allowed. # command and short name, for error messages. declare -r command="$0 $*" declare -r thisScriptName=` basename $0` # toggle some debugging output. declare debug=1 # make the "debug tag" a bit unique so not likely to appear w/i regular output # (can grep out lines w/ it) declare -r debugTAG="DE+buG" function debug() { local -r msg=$1 if [ $debug -eq 0 ] then echo "$debugTAG: $msg" fi } # if script should exit, # shouldExit is some non-zero number, returned as exit status. function userError() { local -r giveTryMsg=$1 local -r shouldExit=$2 local -r msg=$3 echo "$thisScriptName error: $msg" 1>&2 if [ $giveTryMsg -ne 0 ] then echo "Try '$thisScriptName --help' for more information." 1>&2 fi if [ $shouldExit -ne 0 ]; then exit $shouldExit fi } ### homework test parameters, flags ### # from command line declare diffTool="diff" declare showDiff=false # true if showdiff is set # name of HW Descriptor File declare -r HDF="HWDesc" declare -r markerPrefix="+" # indicates command lines in HDF, e.g., "+part3" ### functions ### function printUsage { cat <<EOF Usage: $thisScriptName [OPTIONS] OPTIONS: -h, --help Display this help menu. -d diffTool, --diff=diffTool Use diffTool to compare expected and actual outputs; default is diff. -s, --showDiffs Show the differences from a previous run of $thisScriptName. -t or --test (HW2 only.) Run only specified test(s). -T or --Test (HW2 only.) Like -t, but for tests with non-standard names. -m or --masquerade=partName Run within a part subdirectory with a non-standard name as though running within partName. For more information, see the web page for tester on the class web page. EOF } function mustCd { local -r dir=$1 cd "$dir" if [ $? -ne 0 ] then userError 0 1 "failed to change directory $dir" fi } # returns $diffTool's exit status indicating whether two files are same. function runDiffTool { local -r file1="$1" local -r file2="$2" $diffTool "$file1" "$file2" } # if no diffs, tkdiff still pops up and needs to be exited by a keystroke. # this doesn't invoke tkdiff unless there is a diff. # # not used by tester itself, but by users as the diffTool via "-d cmpORtkdiff" function cmpORtkdiff { local -r file1="$1" local -r file2="$2" cmp -s "$file1" "$file2" || tkdiff "$file1" "$file2" } # runCommand returns: # actual status of command function runCommand { local cmnd=$1 local -r fileIn=$2 local -r fileOut=$3 local -r redirectOutput=$4 debug " runCommand t=$t" debug "runCommand cmnd=$cmnd" # cmnd w/ any redirection local rcmnd="$cmnd" if [ -n "$fileIn" ] then rcmnd+=" < $fileIn" fi if [ -n "$fileOut" ] then rcmnd+=" > $fileOut" fi # do this *after* redirecting ">" if [[ "$redirectOutput" == "true" ]]; then rcmnd+=" 2>&1" fi eval $rcmnd local runStatus=$? debug "cmnd=$cmnd runStatus=$runStatus" return $runStatus } # reads from stdin, which has been set (via redirection) by caller. function testAll { local whichPart local numRuns # number of commands to run local retStat=0 # status to return: did all goes as expected? # handle each part while searchHDF 1 do whichPart="$searchHDFRetValPart" numRuns=$searchHDFRetValNumRuns # got a part! debug "got a part! $whichPart $numRuns" mustCd "$whichPart" testPart "$whichPart" $numRuns retStat=$(($retStat || $?)) mustCd ".." done return $retStat } # reads from stdin, which has been set (via redirection) by caller. # positioned at "+" lines in HDF function testPart { local -r whichPart="$1" local -r numRuns=$2 # number of commands to run runs ## read from HDF local redirectOutput # true if command output should be redirected to output file # false if command redirects output itself (e.g., clisp, gprolog) # or output not needed (e.g., make, rm) local shouldDiff # true if diffTool should be used local YO # output file name local YC # correct output file name local statusCorrect # expected command status local cmnd # command called local marker local i # status to return from this entire function -- did all go as expected? local returnStatus=0 echo "======== $whichPart ========" # loop for all the commands that need to be run for (( i = 0; i < $numRuns; i++ )); do read marker redirectOutput shouldDiff YO YC statusCorrect cmnd debug "for loop i=$i marker=$marker numRuns=$numRuns \"cmnd=$cmnd\"" # integrity check if [ "$marker" != "$markerPrefix$whichPart" ] then userError 0 1 "got bad marker (\"$marker\") instead of expected (\"$markerPrefix$whichPart\") from \"$HDF\" file" fi if ! [ $onlyShowDiffs -eq 0 ] then if [[ "$redirectOutput" == "true" ]]; then runCommand "$cmnd" "" "$YO" "$redirectOutput" else runCommand "$cmnd" "" "" "$redirectOutput" fi local runStatus=$? compareStatuses "$cmnd" $runStatus $statusCorrect returnStatus=$(($returnStatus || $?)) if [[ "$shouldDiff" == "true" ]] then runDiffTool "$YC" "$YO" # shouldn't have any differences, so count it too. returnStatus=$(($returnStatus || $?)) fi elif isHW2 then # some magic (aka, a hack) # need to runcommand hw2special # to see its diff, # but we skip over it above. # could not skip over it, but that gets uglier. # so special case it here. # (could call a different function in Addendum, # which just does the diffs, # but that would replicate # some of hw2special's code.) hw2special 999 # any number will do returnStatus=$? # assume that only want to do this once break else # written so that will runDiffTool # for each command for which $shouldDiff is set. # set $returnStatus to pretend all was well. returnStatus=0 if [ -r "$YO" ] && [ "$shouldDiff" == "true" ] then runDiffTool $YC $YO fi fi # don't keep doing other commands for this part # if one command didn't complete as expected. if [ $returnStatus -ne 0 ] then break fi debug "end for loop i=$i numRuns=$numRuns \"cmnd=$cmnd\"" done return $returnStatus } # check expected and actual statuses. # don't put this checking as part of runCommand # since that generates error message, # and invokers (namely for HW2) sometimes want to redirect stderr. function compareStatuses { local cmnd=$1 local got=$2 local wanted=$3 local returnStatus if [ $got -ne $wanted ] then userError 0 0 "\"$cmnd\" completed with incorrect status of $got vs. expected status of $wanted" returnStatus=1 else returnStatus=0 fi return $returnStatus } # user specified tests declare specificTests # tests from -t declare specificTests2 # tests from -T # for -m, non-standard part declare masqueradeAs declare masqueradeOption # don't actually run the commands # only show diffs based on their last runs. declare onlyShowDiffs=1 ### read parameters ### # each LONGOPTION has a corresponding SHORTOPTION declare -r LO0="help,debug" declare -r LO1="diff:,masquerade:,showDiffs" declare -r LO2="test:,Test:" declare -r LONGOPTIONS="$LO0,$LO1,$LO2" declare -r SHORTOPTIONS="hgd:m:st:T:" # bash note: don't combine next two lines (declare and assignment) # since would get exit status of declare (success), not exit status of getopt. declare args # getopt note: -o needs to be last option. args=$(getopt --name=$thisScriptName -l "$LONGOPTIONS" -o "$SHORTOPTIONS" -- "$@") if [ $? -ne 0 ] then userError 1 1 "couldn't process command line arguments" fi eval set -- "$args" # handle options and their arguments while true do declare arg="$1" case "$arg" in -h|--help) printUsage exit 0 ;; -g|--debug) shift debug=$((!$debug)) ;; -d|--diff) shift diffTool="$1" shift ;; -m|--masquerade) shift masqueradeOption="$1" masqueradeAs="$1" shift ;; -t|--tests) shift specificTests+=" $1" shift ;; -T|--Tests) shift specificTests2+=" $1" shift ;; -s|--showDiffs) shift onlyShowDiffs=0 ;; --) shift break ;; *) userError 1 1 "unknown command-line argument \"$arg\"" # above exits ;; esac done if [ $# -gt 0 ] then userError 1 1 "unknown command-line argument(s) \"$*\"" fi # note: considered using bash's way to figure out location of source # (using ${BASH_SOURCE[0], etc.) # but for testing new versions, that location wouldn't relate to relPath. declare relPath declare relPathHDF # are we in main HW directory or in a part directory? # null means false declare inHW declare inPart # find $HDF # sets globals, as appropriate function findHDF { if [ -e "$HDF" ] then inHW=0 # any non-null relPath="." elif [ -e "../$HDF" ] then inPart=0 # any non-null relPath=".." else userError 0 1 "can't find $HDF" fi relPathHDF="$relPath/$HDF" # sanity check if [ ! -r "$relPathHDF" ] then userError 0 1 "found $relPathHDF but can't read it (use chmod to fix its permission bits)" fi debug "found $relPathHDF $relPathHDF" } # supposedly in a part directory. # check that it's known. # return that part in a global declare findPartRetVal function findPart { local -r where=`pwd` local -r base=`basename $where` debug "base=$base" debug "rel=$relPathHDF base=$base" checkPartName "$base" # exits if bad part findPartRetVal="$base" } # known part name? function checkPartName { local -r base="$1" if ! searchHDF 0 "$base" < "$relPathHDF" then userError 1 1 "found $base but that's not a standard part name (use, e.g., \"-m part06\" to specify part06)" fi debug "checkPartName found part $base !" } # search HDF for part # reads from stdin, which has been set (via redirection) by caller. # two modes: # search for given part # search for next part # for either successful search, sets globals for that part declare searchHDFRetValPart declare searchHDFRetValNumRuns function searchHDF { local -r givenPartMode=$1 local -r part="$2" local whichPart local numRuns while read whichPart numRuns do case $whichPart in "#"*) continue;; "$markerPrefix"*) continue;; "") continue;; *) if [ $givenPartMode -eq 1 ] || [ "$whichPart" = "$part" ] then searchHDFRetValPart="$whichPart" searchHDFRetValNumRuns=$numRuns return 0 fi ;; esac done return 1 } # calls other functions that read from stdin, # which has been set (via redirection) by caller. function doAPart { local thePart="$1" local numRuns searchHDF 0 "$thePart" numRuns=$searchHDFRetValNumRuns testPart "$thePart" $numRuns # returns testPart's status } # these are very conservative. # ideally, specify for each HW, or even part of HW. ulimit -t 12 # time (seconds) ulimit -f 12000 # space (disk blocks) # if ulimit -f is exceeded, core file is created, but we don't want one ulimit -c 0 # prevent core file from being created ### test ### findHDF # any extra pieces needed for testing? declare -r testerAddendum="testerAddendum" if [ -r "$relPath/$testerAddendum" ] then source "$relPath/$testerAddendum" fi # are we testing HW2? # don't use this function until after doing above source. function isHW2 { declare -F hw2special > /dev/null } if ! isHW2 && ( [ -n "$specificTests" ] || [ -n "$specificTests2" ] ) then userError 0 1 "can only use \"-t\" or \"-T\" with HW2" fi declare retStatus=0 if [ -n "$inPart" ] then debug "inPart" declare thePart if [ -n "$masqueradeAs" ] then checkPartName "$masqueradeAs" thePart="$masqueradeAs" else findPart thePart="$findPartRetVal" fi doAPart "$thePart" < "$relPathHDF" retStat=$? elif [ -n "$inHW" ] then if [ -n "$masqueradeAs" ] then userError 0 1 "$masqueradeOption specified in HW directory; must be in a part directory (so, first cd to where you want to test)" fi debug "inHW $relPathHDF" testAll < "$relPathHDF" retStat=$? echo -n "$thisScriptName summary: " if [ $retStat -eq 0 ] then echo "all went well!" else echo "some possible problems, which were previously noted." fi else userError 0 1 "OOPS: neither inPart (\"$inPart\") nor inHW (\"$inHW\")" fi # returns exit status of testing commands. exit $retStat

Given/README

*** This "README" file is parsed by Perl. *** *** DO NOT change the format of the first 8 lines of this file *** Student ID (last 6 digits): xx-xxxx Name(last): xxxx Name(first): xxxx Login_ID: xxxxx Status: part0: Works on all tests. part1: Works on all tests. part2: Works on all tests. part3: Works on all tests. part4: Works on all tests. part5: Works on only the first test case. part6: Didn't attempt. part7: Didn't attempt. part8: Didn't attempt. part9: Didn't attempt. Overall: Any comment/discussion related to this HW.

Given/part3/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: created 41 Element created 7 EBoolean created 13 EInteger created 21 EString

Given/part3/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part3/Main.java

Given/part3/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/part1/Output.correct

b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16:

Given/part1/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part1/Main.java

Given/part1/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
         System . exit ( 0 );
     }
}

Given/part8/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: l1.capacity():2: l1.size():0: l1 ++++ ---- l1.capacity():2: l1.size():1: l1 ++++ 34 ---- l1.capacity():2: l1.size():2: l1 ++++ 34 $false$ ---- l2.capacity():2: l2.size():0: l2 ++++ ---- l2.capacity():2: l2.size():1: l2 ++++ abcdefghijklmnopqrstuvwx ---- l2.capacity():2: l2.size():2: l2 ++++ abcdefghijklmnopqrstuvwx abc ---- l1.capacity():4: l1.size():3: l1 ++++ 34 $false$ $true$ ---- l1.capacity():4: l1.size():4: l1 ++++ 34 $false$ $true$ 101 ---- l1.capacity():8: l1.size():5: l1 ++++ 34 $false$ $true$ 101 102 ---- l1.capacity():8: l1.size():6: l1 ++++ 34 $false$ $true$ 101 102 103 ---- l1.capacity():8: l1.size():7: l1 ++++ 34 $false$ $true$ 101 102 103 104 ---- l1.capacity():8: l1.size():8: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 ---- l1.capacity():16: l1.size():9: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 ---- l1.capacity():16: l1.size():10: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 ---- l1.capacity():16: l1.size():11: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 ---- l1.capacity():16: l1.size():12: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 ---- l1.capacity():16: l1.size():13: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 ---- l1.capacity():16: l1.size():14: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 ---- l1.capacity():16: l1.size():15: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 ---- l1.capacity():16: l1.size():16: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 ---- l1.capacity():32: l1.size():17: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 ---- l1.capacity():32: l1.size():18: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 ---- l1.capacity():32: l1.size():19: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ---- l1.capacity():32: l1.size():20: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 ---- l1.capacity():32: l1.size():21: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ---- l1.capacity():32: l1.size():22: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 ---- l3.capacity():2: l3.size():0: l3 ++++ ---- l3.capacity():16: l3.size():10: l3 ++++ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ ---- myprint(l1) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! myprint(l2) abcdefghijklmnopqrstuvwx!abc! myprint(l3) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! cross(l2, l2) abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abcdefghijklmnopqrstuvwx abc abc abcdefghijklmnopqrstuvwx abc abc cross(l1, l2) 34 abcdefghijklmnopqrstuvwx 34 abc $false$ abcdefghijklmnopqrstuvwx $false$ abc $true$ abcdefghijklmnopqrstuvwx $true$ abc 101 abcdefghijklmnopqrstuvwx 101 abc 102 abcdefghijklmnopqrstuvwx 102 abc 103 abcdefghijklmnopqrstuvwx 103 abc 104 abcdefghijklmnopqrstuvwx 104 abc 105 abcdefghijklmnopqrstuvwx 105 abc 106 abcdefghijklmnopqrstuvwx 106 abc 107 abcdefghijklmnopqrstuvwx 107 abc 108 abcdefghijklmnopqrstuvwx 108 abc 109 abcdefghijklmnopqrstuvwx 109 abc 110 abcdefghijklmnopqrstuvwx 110 abc 111 abcdefghijklmnopqrstuvwx 111 abc 112 abcdefghijklmnopqrstuvwx 112 abc 113 abcdefghijklmnopqrstuvwx 113 abc 114 abcdefghijklmnopqrstuvwx 114 abc 115 abcdefghijklmnopqrstuvwx 115 abc 116 abcdefghijklmnopqrstuvwx 116 abc 117 abcdefghijklmnopqrstuvwx 117 abc 118 abcdefghijklmnopqrstuvwx 118 abc 119 abcdefghijklmnopqrstuvwx 119 abc cross(l2, l1) abcdefghijklmnopqrstuvwx 34 abcdefghijklmnopqrstuvwx $false$ abcdefghijklmnopqrstuvwx $true$ abcdefghijklmnopqrstuvwx 101 abcdefghijklmnopqrstuvwx 102 abcdefghijklmnopqrstuvwx 103 abcdefghijklmnopqrstuvwx 104 abcdefghijklmnopqrstuvwx 105 abcdefghijklmnopqrstuvwx 106 abcdefghijklmnopqrstuvwx 107 abcdefghijklmnopqrstuvwx 108 abcdefghijklmnopqrstuvwx 109 abcdefghijklmnopqrstuvwx 110 abcdefghijklmnopqrstuvwx 111 abcdefghijklmnopqrstuvwx 112 abcdefghijklmnopqrstuvwx 113 abcdefghijklmnopqrstuvwx 114 abcdefghijklmnopqrstuvwx 115 abcdefghijklmnopqrstuvwx 116 abcdefghijklmnopqrstuvwx 117 abcdefghijklmnopqrstuvwx 118 abcdefghijklmnopqrstuvwx 119 abc 34 abc $false$ abc $true$ abc 101 abc 102 abc 103 abc 104 abc 105 abc 106 abc 107 abc 108 abc 109 abc 110 abc 111 abc 112 abc 113 abc 114 abc 115 abc 116 abc 117 abc 118 abc 119 cross(l1, l3) 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $false$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ 34 $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $false$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 101 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $false$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 102 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $false$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 103 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $false$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 104 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $false$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 105 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $false$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 106 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $false$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 107 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $false$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 108 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $false$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 109 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $false$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 110 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $false$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 111 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $false$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 112 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $false$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 113 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $false$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 114 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $false$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 115 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $false$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 116 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $false$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 117 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $false$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 118 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $false$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ 119 $true$ cross(l3, l1) $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 cross(l1, l1) 34 34 34 $false$ 34 $true$ 34 101 34 102 34 103 34 104 34 105 34 106 34 107 34 108 34 109 34 110 34 111 34 112 34 113 34 114 34 115 34 116 34 117 34 118 34 119 $false$ 34 $false$ $false$ $false$ $true$ $false$ 101 $false$ 102 $false$ 103 $false$ 104 $false$ 105 $false$ 106 $false$ 107 $false$ 108 $false$ 109 $false$ 110 $false$ 111 $false$ 112 $false$ 113 $false$ 114 $false$ 115 $false$ 116 $false$ 117 $false$ 118 $false$ 119 $true$ 34 $true$ $false$ $true$ $true$ $true$ 101 $true$ 102 $true$ 103 $true$ 104 $true$ 105 $true$ 106 $true$ 107 $true$ 108 $true$ 109 $true$ 110 $true$ 111 $true$ 112 $true$ 113 $true$ 114 $true$ 115 $true$ 116 $true$ 117 $true$ 118 $true$ 119 101 34 101 $false$ 101 $true$ 101 101 101 102 101 103 101 104 101 105 101 106 101 107 101 108 101 109 101 110 101 111 101 112 101 113 101 114 101 115 101 116 101 117 101 118 101 119 102 34 102 $false$ 102 $true$ 102 101 102 102 102 103 102 104 102 105 102 106 102 107 102 108 102 109 102 110 102 111 102 112 102 113 102 114 102 115 102 116 102 117 102 118 102 119 103 34 103 $false$ 103 $true$ 103 101 103 102 103 103 103 104 103 105 103 106 103 107 103 108 103 109 103 110 103 111 103 112 103 113 103 114 103 115 103 116 103 117 103 118 103 119 104 34 104 $false$ 104 $true$ 104 101 104 102 104 103 104 104 104 105 104 106 104 107 104 108 104 109 104 110 104 111 104 112 104 113 104 114 104 115 104 116 104 117 104 118 104 119 105 34 105 $false$ 105 $true$ 105 101 105 102 105 103 105 104 105 105 105 106 105 107 105 108 105 109 105 110 105 111 105 112 105 113 105 114 105 115 105 116 105 117 105 118 105 119 106 34 106 $false$ 106 $true$ 106 101 106 102 106 103 106 104 106 105 106 106 106 107 106 108 106 109 106 110 106 111 106 112 106 113 106 114 106 115 106 116 106 117 106 118 106 119 107 34 107 $false$ 107 $true$ 107 101 107 102 107 103 107 104 107 105 107 106 107 107 107 108 107 109 107 110 107 111 107 112 107 113 107 114 107 115 107 116 107 117 107 118 107 119 108 34 108 $false$ 108 $true$ 108 101 108 102 108 103 108 104 108 105 108 106 108 107 108 108 108 109 108 110 108 111 108 112 108 113 108 114 108 115 108 116 108 117 108 118 108 119 109 34 109 $false$ 109 $true$ 109 101 109 102 109 103 109 104 109 105 109 106 109 107 109 108 109 109 109 110 109 111 109 112 109 113 109 114 109 115 109 116 109 117 109 118 109 119 110 34 110 $false$ 110 $true$ 110 101 110 102 110 103 110 104 110 105 110 106 110 107 110 108 110 109 110 110 110 111 110 112 110 113 110 114 110 115 110 116 110 117 110 118 110 119 111 34 111 $false$ 111 $true$ 111 101 111 102 111 103 111 104 111 105 111 106 111 107 111 108 111 109 111 110 111 111 111 112 111 113 111 114 111 115 111 116 111 117 111 118 111 119 112 34 112 $false$ 112 $true$ 112 101 112 102 112 103 112 104 112 105 112 106 112 107 112 108 112 109 112 110 112 111 112 112 112 113 112 114 112 115 112 116 112 117 112 118 112 119 113 34 113 $false$ 113 $true$ 113 101 113 102 113 103 113 104 113 105 113 106 113 107 113 108 113 109 113 110 113 111 113 112 113 113 113 114 113 115 113 116 113 117 113 118 113 119 114 34 114 $false$ 114 $true$ 114 101 114 102 114 103 114 104 114 105 114 106 114 107 114 108 114 109 114 110 114 111 114 112 114 113 114 114 114 115 114 116 114 117 114 118 114 119 115 34 115 $false$ 115 $true$ 115 101 115 102 115 103 115 104 115 105 115 106 115 107 115 108 115 109 115 110 115 111 115 112 115 113 115 114 115 115 115 116 115 117 115 118 115 119 116 34 116 $false$ 116 $true$ 116 101 116 102 116 103 116 104 116 105 116 106 116 107 116 108 116 109 116 110 116 111 116 112 116 113 116 114 116 115 116 116 116 117 116 118 116 119 117 34 117 $false$ 117 $true$ 117 101 117 102 117 103 117 104 117 105 117 106 117 107 117 108 117 109 117 110 117 111 117 112 117 113 117 114 117 115 117 116 117 117 117 118 117 119 118 34 118 $false$ 118 $true$ 118 101 118 102 118 103 118 104 118 105 118 106 118 107 118 108 118 109 118 110 118 111 118 112 118 113 118 114 118 115 118 116 118 117 118 118 118 119 119 34 119 $false$ 119 $true$ 119 101 119 102 119 103 119 104 119 105 119 106 119 107 119 108 119 109 119 110 119 111 119 112 119 113 119 114 119 115 119 116 119 117 119 118 119 119 cross(l3, l3) $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $false$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ $true$ noSideEffects(new EList()) myprint(l) l.size():0: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l1) myprint(l) 34!$false$!$true$!101!102!103!104!105!106!107!108!109!110!111!112!113!114!115!116!117!118!119! l.size():22: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():34: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$false$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: noSideEffects(l2) myprint(l) abcdefghijklmnopqrstuvwx!abc! l.size():2: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abcdefghijklmnopqrstuvwx: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():abc: t.hasNext():false: t.hasNext():false: t.hasNext():false: t.hasNext():false: noSideEffects(l3) myprint(l) $true$!$true$!$true$!$true$!$false$!$true$!$true$!$true$!$true$!$true$! l.size():10: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.hasNext():true: t.next():$true$: test of calling EListIt too many times ei.next():61: ei.next():63: ei.next():62: = caught UsingIteratorPastEndException from EListIt EListUser.size1(new EList()):0: EListUser.size1(l1):22: EListUser.size1(l2):2: EListUser.size1(l3):10: EListUser.size2(new EList()):0: EListUser.size2(l1):22: EListUser.size2(l2):2: EListUser.size2(l3):10: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):false: EListUser.isBalanced(k0):true: EListUser.isBalanced(k0):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):false: EListUser.isBalanced(k1):true: EListUser.isBalanced(k1):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):false: EListUser.isBalanced(k2):true: EListUser.isBalanced(k2):true: EListUser.isBalanced(l1):false: EListUser.isBalanced(l2):true: EListUser.isBalanced(l3):true: created 171 Element created 11 EBoolean created 63 EInteger created 97 EString

Given/part8/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part8/Main.java

Given/part8/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // list stuff
         EList  l1  =   new   EList ();
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( i1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( b2 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         EList  l2  =   new   EList ();
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s4 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s1 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l1 . add ( b1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         for   ( int  k  =   101 ;  k  <   120 ;  k ++ )   {
            l1 . add ( new   EInteger ( k ));
             System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
             System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
             System . out . println (   "l1"   );  
              System . out . println ( l1 );
         }
         EList  l3  =   new   EList ();
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b2 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
         // test iterators
         System . out . println (   "myprint(l1)"   );  
             myprint ( l1 );
         System . out . println (   "myprint(l2)"   );  
             myprint ( l2 );
         System . out . println (   "myprint(l3)"   );  
             myprint ( l3 );
         System . out . println (   "cross(l2, l2)"   );  
             cross ( l2 ,  l2 );
         System . out . println (   "cross(l1, l2)"   );  
             cross ( l1 ,  l2 );
         System . out . println (   "cross(l2, l1)"   );  
             cross ( l2 ,  l1 );
         System . out . println (   "cross(l1, l3)"   );  
             cross ( l1 ,  l3 );
         System . out . println (   "cross(l3, l1)"   );  
             cross ( l3 ,  l1 );
         System . out . println (   "cross(l1, l1)"   );  
             cross ( l1 ,  l1 );
         System . out . println (   "cross(l3, l3)"   );  
             cross ( l3 ,  l3 );
         System . out . println (   "noSideEffects(new EList())"   );  
             noSideEffects ( new   EList ());
         System . out . println (   "noSideEffects(l1)"   );  
             noSideEffects ( l1 );
         System . out . println (   "noSideEffects(l2)"   );  
             noSideEffects ( l2 );
         System . out . println (   "noSideEffects(l3)"   );  
             noSideEffects ( l3 );
  try   {
             System . out . println ( "test of calling EListIt"
                   + " too many times" );
             EList  el  =   new   EList ();
     el . add ( new   EInteger ( 61 ));
     el . add ( new   EInteger ( 63 ));
     el . add ( new   EInteger ( 62 ));
             EListIt  ei  =  el . iterator ();
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
             System . out . println (   "ei.next()"   +   ":"   +   ( ei . next ())   +   ":" );
  }
         catch   ( UsingIteratorPastEndException  e )   {
             System . out . println ( "= caught UsingIteratorPastEndException from EListIt" );
  }
  System . out . println (   "EListUser.size1(new EList())"   +   ":"   +   ( EListUser . size1 ( new   EList ()))   +   ":" );
  System . out . println (   "EListUser.size1(l1)"   +   ":"   +   ( EListUser . size1 ( l1 ))   +   ":" );
  System . out . println (   "EListUser.size1(l2)"   +   ":"   +   ( EListUser . size1 ( l2 ))   +   ":" );
  System . out . println (   "EListUser.size1(l3)"   +   ":"   +   ( EListUser . size1 ( l3 ))   +   ":" );
  System . out . println (   "EListUser.size2(new EList())"   +   ":"   +   ( EListUser . size2 ( new   EList ()))   +   ":" );
  System . out . println (   "EListUser.size2(l1)"   +   ":"   +   ( EListUser . size2 ( l1 ))   +   ":" );
  System . out . println (   "EListUser.size2(l2)"   +   ":"   +   ( EListUser . size2 ( l2 ))   +   ":" );
  System . out . println (   "EListUser.size2(l3)"   +   ":"   +   ( EListUser . size2 ( l3 ))   +   ":" );
  {
         EList  k0  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
        k0 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k0)"   +   ":"   +   ( EListUser . isBalanced ( k0 ))   +   ":" );
         EList  k1  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( b2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s1 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s3 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( i2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
        k1 . add ( s2 );
  System . out . println (   "EListUser.isBalanced(k1)"   +   ":"   +   ( EListUser . isBalanced ( k1 ))   +   ":" );
         EList  k2  =   new   EList ();
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( b1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
        k2 . add ( i1 );
  System . out . println (   "EListUser.isBalanced(k2)"   +   ":"   +   ( EListUser . isBalanced ( k2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l1)"   +   ":"   +   ( EListUser . isBalanced ( l1 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l2)"   +   ":"   +   ( EListUser . isBalanced ( l2 ))   +   ":" );
  System . out . println (   "EListUser.isBalanced(l3)"   +   ":"   +   ( EListUser . isBalanced ( l3 ))   +   ":" );
  }
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  myprint ( EList  l )   {
         Element  e ;
         EListIt  t  =  l . iterator ();
         while   (  t . hasNext ()   )   {
      try   {
                 System . out . print ( t . next () + "!" );
      }
             catch   ( UsingIteratorPastEndException  ee )   {
                 System . out . println ( "myprint oops! caught UsingIteratorPastEndException" );
             }
         }
         System . out . println ();
     }
     private   static   void  cross ( EList  l1 ,   EList  l2 )   {
         EListIt  t1  =  l1 . iterator ();
         while   (  t1 . hasNext ()   )   {
      try   {
                 Element  e1  =  t1 . next ();
                 EListIt  t2  =  l2 . iterator ();
                 while   (  t2 . hasNext ()   )   {
                      System . out . println ( "    "   +  e1  +   " "   +  t2 . next ()   );
                 }
      }
             catch   ( UsingIteratorPastEndException  e )   {
                 System . out . println ( "cross oops! caught UsingIteratorPastEndException" );
             }
         }
     }
     // check that hasNext has no side effects.
     // this entire test uses a single iterator.
     // each "run" calls hasNext HN times
     // before printing out the next element (if there is one).
     // test w/ (at least) lists of size=0, 0<size<HN, size>HN*RUNS.
     private   static   void  noSideEffects ( EList  l )   {
  final   int  RUNS  =   3 ;
  final   int  HN  =   4 ;
         System . out . println (   "myprint(l)"   );  
             myprint ( l );
  System . out . println (   "l.size()"   +   ":"   +   ( l . size ())   +   ":" );
         EListIt  t  =  l . iterator ();
  for   ( int  run  =   1 ;  run  <=  RUNS ;  run ++ )   {
      for   ( int  k  =   1 ;  k  <=  HN ;  k ++ )   {
          System . out . println (   "t.hasNext()"   +   ":"   +   ( t . hasNext ())   +   ":" );
      }
      if   (  t . hasNext ()   )   {
          try   {
                     System . out . println (   "t.next()"   +   ":"   +   ( t . next ())   +   ":" );
          }
                 catch   ( UsingIteratorPastEndException  e )   {
                     System . out . println ( "noSideEffects oops! caught UsingIteratorPastEndException" );
                 }
       }
  }
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}

Given/part6/Output.correct

created 9 Element created 2 EBoolean created 3 EInteger created 4 EString b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: b1:$true$: (Element)b1 instanceof EBoolean:true: (Element)b1 instanceof EInteger:false: (Element)b1 instanceof EString:false: b2:$false$: (Element)b2 instanceof EBoolean:true: (Element)b2 instanceof EInteger:false: (Element)b2 instanceof EString:false: i1:34: (Element)i1 instanceof EBoolean:false: (Element)i1 instanceof EInteger:true: (Element)i1 instanceof EString:false: i2:-87: (Element)i2 instanceof EBoolean:false: (Element)i2 instanceof EInteger:true: (Element)i2 instanceof EString:false: i3:23: (Element)i3 instanceof EBoolean:false: (Element)i3 instanceof EInteger:true: (Element)i3 instanceof EString:false: s1:abc: (Element)s1 instanceof EBoolean:false: (Element)s1 instanceof EInteger:false: (Element)s1 instanceof EString:true: s2:: (Element)s2 instanceof EBoolean:false: (Element)s2 instanceof EInteger:false: (Element)s2 instanceof EString:true: s3:abcdefghijklmnopqrstuvwx: (Element)s3 instanceof EBoolean:false: (Element)s3 instanceof EInteger:false: (Element)s3 instanceof EString:true: s4:abcdefghijklmnopqrstuvwx: (Element)s4 instanceof EBoolean:false: (Element)s4 instanceof EInteger:false: (Element)s4 instanceof EString:true: x:abc: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:false: (Element)x instanceof EString:true: x:-87: (Element)x instanceof EBoolean:false: (Element)x instanceof EInteger:true: (Element)x instanceof EString:false: Go g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: Go figure g:Go: (Element)g instanceof EBoolean:false: (Element)g instanceof EInteger:false: (Element)g instanceof EString:true: b1.hash():1: b2.hash():0: i1.hash():0: i2.hash():2: i3.hash():6: s1.hash():3: s2.hash():0: s3.hash():7: s4.hash():7: x.hash():3: x.hash():2: new EInteger(84).hash():16: Plus.plus(i3, i3):46: (Element)Plus.plus(i3, i3) instanceof EBoolean:false: (Element)Plus.plus(i3, i3) instanceof EInteger:true: (Element)Plus.plus(i3, i3) instanceof EString:false: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(i1, i2):-53: (Element)Plus.plus(i1, i2) instanceof EBoolean:false: (Element)Plus.plus(i1, i2) instanceof EInteger:true: (Element)Plus.plus(i1, i2) instanceof EString:false: Plus.plus(b1, b2):$true$: (Element)Plus.plus(b1, b2) instanceof EBoolean:true: (Element)Plus.plus(b1, b2) instanceof EInteger:false: (Element)Plus.plus(b1, b2) instanceof EString:false: Plus.plus(s1, s1):abcabc: (Element)Plus.plus(s1, s1) instanceof EBoolean:false: (Element)Plus.plus(s1, s1) instanceof EInteger:false: (Element)Plus.plus(s1, s1) instanceof EString:true: Plus.plus(s3, s1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s1) instanceof EBoolean:false: (Element)Plus.plus(s3, s1) instanceof EInteger:false: (Element)Plus.plus(s3, s1) instanceof EString:true: Plus.plus(s3, s4):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, s4) instanceof EBoolean:false: (Element)Plus.plus(s3, s4) instanceof EInteger:false: (Element)Plus.plus(s3, s4) instanceof EString:true: Plus.plus(b1, s1):$true$abc: (Element)Plus.plus(b1, s1) instanceof EBoolean:false: (Element)Plus.plus(b1, s1) instanceof EInteger:false: (Element)Plus.plus(b1, s1) instanceof EString:true: Plus.plus(b1, s2):$true$: (Element)Plus.plus(b1, s2) instanceof EBoolean:false: (Element)Plus.plus(b1, s2) instanceof EInteger:false: (Element)Plus.plus(b1, s2) instanceof EString:true: Plus.plus(b1, s3):$true$abcdefghijklmnopqr: (Element)Plus.plus(b1, s3) instanceof EBoolean:false: (Element)Plus.plus(b1, s3) instanceof EInteger:false: (Element)Plus.plus(b1, s3) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(s2, b1):$true$: (Element)Plus.plus(s2, b1) instanceof EBoolean:false: (Element)Plus.plus(s2, b1) instanceof EInteger:false: (Element)Plus.plus(s2, b1) instanceof EString:true: Plus.plus(s3, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s3, b1) instanceof EBoolean:false: (Element)Plus.plus(s3, b1) instanceof EInteger:false: (Element)Plus.plus(s3, b1) instanceof EString:true: Plus.plus(i1, b1):35: (Element)Plus.plus(i1, b1) instanceof EBoolean:false: (Element)Plus.plus(i1, b1) instanceof EInteger:true: (Element)Plus.plus(i1, b1) instanceof EString:false: Plus.plus(i1, b2):34: (Element)Plus.plus(i1, b2) instanceof EBoolean:false: (Element)Plus.plus(i1, b2) instanceof EInteger:true: (Element)Plus.plus(i1, b2) instanceof EString:false: Plus.plus(i1, s1):34abc: (Element)Plus.plus(i1, s1) instanceof EBoolean:false: (Element)Plus.plus(i1, s1) instanceof EInteger:false: (Element)Plus.plus(i1, s1) instanceof EString:true: Plus.plus(b1, i1):35: (Element)Plus.plus(b1, i1) instanceof EBoolean:false: (Element)Plus.plus(b1, i1) instanceof EInteger:true: (Element)Plus.plus(b1, i1) instanceof EString:false: Plus.plus(b2, i1):34: (Element)Plus.plus(b2, i1) instanceof EBoolean:false: (Element)Plus.plus(b2, i1) instanceof EInteger:true: (Element)Plus.plus(b2, i1) instanceof EString:false: Plus.plus(s1, i1):abc34: (Element)Plus.plus(s1, i1) instanceof EBoolean:false: (Element)Plus.plus(s1, i1) instanceof EInteger:false: (Element)Plus.plus(s1, i1) instanceof EString:true: Plus.plus(s1, b1):abc$true$: (Element)Plus.plus(s1, b1) instanceof EBoolean:false: (Element)Plus.plus(s1, b1) instanceof EInteger:false: (Element)Plus.plus(s1, b1) instanceof EString:true: Plus.plus(b2, s1):$false$abc: (Element)Plus.plus(b2, s1) instanceof EBoolean:false: (Element)Plus.plus(b2, s1) instanceof EInteger:false: (Element)Plus.plus(b2, s1) instanceof EString:true: Plus.plus(s4, b1):abcdefghijklmnopqrstuvwx: (Element)Plus.plus(s4, b1) instanceof EBoolean:false: (Element)Plus.plus(s4, b1) instanceof EInteger:false: (Element)Plus.plus(s4, b1) instanceof EString:true: Plus.plus(b2, s4):$false$abcdefghijklmnopq: (Element)Plus.plus(b2, s4) instanceof EBoolean:false: (Element)Plus.plus(b2, s4) instanceof EInteger:false: (Element)Plus.plus(b2, s4) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1):35abc34: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString:true: Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1):3534: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger:false: (Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString:true: s5:hi: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:ok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: s5:okok: (Element)s5 instanceof EBoolean:false: (Element)s5 instanceof EInteger:false: (Element)s5 instanceof EString:true: s6:ok: (Element)s6 instanceof EBoolean:false: (Element)s6 instanceof EInteger:false: (Element)s6 instanceof EString:true: t:$false$: (Element)t instanceof EBoolean:true: (Element)t instanceof EInteger:false: (Element)t instanceof EString:false: t:-53: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:true: (Element)t instanceof EString:false: t:okokok: (Element)t instanceof EBoolean:false: (Element)t instanceof EInteger:false: (Element)t instanceof EString:true: l1.capacity():2: l1.size():0: l1 ++++ ---- l1.capacity():2: l1.size():1: l1 ++++ 34 ---- l1.capacity():2: l1.size():2: l1 ++++ 34 $false$ ---- l2.capacity():2: l2.size():0: l2 ++++ ---- l2.capacity():2: l2.size():1: l2 ++++ abcdefghijklmnopqrstuvwx ---- l2.capacity():2: l2.size():2: l2 ++++ abcdefghijklmnopqrstuvwx abc ---- l1.capacity():4: l1.size():3: l1 ++++ 34 $false$ $true$ ---- l1.capacity():4: l1.size():4: l1 ++++ 34 $false$ $true$ 101 ---- l1.capacity():8: l1.size():5: l1 ++++ 34 $false$ $true$ 101 102 ---- l1.capacity():8: l1.size():6: l1 ++++ 34 $false$ $true$ 101 102 103 ---- l1.capacity():8: l1.size():7: l1 ++++ 34 $false$ $true$ 101 102 103 104 ---- l1.capacity():8: l1.size():8: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 ---- l1.capacity():16: l1.size():9: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 ---- l1.capacity():16: l1.size():10: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 ---- l1.capacity():16: l1.size():11: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 ---- l1.capacity():16: l1.size():12: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 ---- l1.capacity():16: l1.size():13: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 ---- l1.capacity():16: l1.size():14: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 ---- l1.capacity():16: l1.size():15: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 ---- l1.capacity():16: l1.size():16: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 ---- l1.capacity():32: l1.size():17: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 ---- l1.capacity():32: l1.size():18: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 ---- l1.capacity():32: l1.size():19: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 ---- l1.capacity():32: l1.size():20: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 ---- l1.capacity():32: l1.size():21: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 ---- l1.capacity():32: l1.size():22: l1 ++++ 34 $false$ $true$ 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 ---- l3.capacity():2: l3.size():0: l3 ++++ ---- l3.capacity():16: l3.size():10: l3 ++++ $true$ $true$ $true$ $true$ $false$ $true$ $true$ $true$ $true$ $true$ ---- created 168 Element created 11 EBoolean created 60 EInteger created 97 EString

Given/part6/Makefile

SHELL = /bin/sh YO = Output.your YC = Output.correct # note that make will always retranslate all needed .java files, # but that's OK since translation for this program is quick. # (That assumes no junk .java files in this directory.) # (That's unlike using make for C++ where one usually specifies dependencies; # we won't bother trying since translation is quick.) # # (be sure to put class X in file X.java) # the -Xlint checks for a bunch of bad things. # must use -Xlint; mustn't have any warnings. # except for the provided Main.java (which has some redundant casts) # if you have non-standard ls or grep, you'll need to give pathnames: ## NotMainJava = `/bin/ls -1 *.java | /bin/grep -v -w Main.java` NotMainJava = `ls -1 *.java | grep -v -w Main.java` # instead of "echo" below, could instead use here # NotMainJava := $(shell /bin/ls -1 *.java | /bin/grep -v -w Main.java) # but that mightn't be supported by all makes. trans: javac Main.java @# make the output a bit nicer looking (i.e., expand $(NotMainJava)) @echo javac -Xlint $(NotMainJava) @javac -Xlint $(NotMainJava) # invoke via "make clean". clean: /bin/rm -f *.class *~ $(YO) # just do `make remake' instead of `make clean; make' remake: clean trans

Given/part6/Main.java

Given/part6/Main.java

/* *** This file is given as part of the programming assignment. *** */
public   class   Main   {
     public   static   void  main ( String   []  args )   {
         // instantiate some elements
         EBoolean  b1  =   new   EBoolean ( 1 );
         EBoolean  b2  =   new   EBoolean ( 0 );
         EInteger  i1  =   new   EInteger ( 34 );
         EInteger  i2  =   new   EInteger ( - 87 );
         EInteger  i3  =   new   EInteger ( 23 );
         EString  s1  =   new   EString ( "abc" );
         EString  s2  =   new   EString ( "" );
         EString  s3  =   new   EString ( "abcdefghijklmnopqrstuvwxyz0123456789" );
         EString  s4  =   new   EString ( "abcdefghijklmnopqrstuvwx" );
        countOut ();
         // do everything twice just to double check
         for (   int  i  =   0 ;  i  <   2 ;  i ++ )   {
            
              System . out . print (   "b1"   +   ":" );  
              System . out . print ( b1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b1 instanceof EBoolean"   +   ":"   +   (( Element ) b1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EInteger"   +   ":"   +   (( Element ) b1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b1 instanceof EString"   +   ":"   +   (( Element ) b1  instanceof   EString )   +   ":" );
            
              System . out . print (   "b2"   +   ":" );  
              System . out . print ( b2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)b2 instanceof EBoolean"   +   ":"   +   (( Element ) b2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EInteger"   +   ":"   +   (( Element ) b2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)b2 instanceof EString"   +   ":"   +   (( Element ) b2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i1"   +   ":" );  
              System . out . print ( i1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i1 instanceof EBoolean"   +   ":"   +   (( Element ) i1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EInteger"   +   ":"   +   (( Element ) i1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i1 instanceof EString"   +   ":"   +   (( Element ) i1  instanceof   EString )   +   ":" );
            
              System . out . print (   "i2"   +   ":" );  
              System . out . print ( i2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i2 instanceof EBoolean"   +   ":"   +   (( Element ) i2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EInteger"   +   ":"   +   (( Element ) i2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i2 instanceof EString"   +   ":"   +   (( Element ) i2  instanceof   EString )   +   ":" );
            
              System . out . print (   "i3"   +   ":" );  
              System . out . print ( i3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)i3 instanceof EBoolean"   +   ":"   +   (( Element ) i3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EInteger"   +   ":"   +   (( Element ) i3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)i3 instanceof EString"   +   ":"   +   (( Element ) i3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s1"   +   ":" );  
              System . out . print ( s1 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s1 instanceof EBoolean"   +   ":"   +   (( Element ) s1  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EInteger"   +   ":"   +   (( Element ) s1  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s1 instanceof EString"   +   ":"   +   (( Element ) s1  instanceof   EString )   +   ":" );
            
              System . out . print (   "s2"   +   ":" );  
              System . out . print ( s2 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s2 instanceof EBoolean"   +   ":"   +   (( Element ) s2  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EInteger"   +   ":"   +   (( Element ) s2  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s2 instanceof EString"   +   ":"   +   (( Element ) s2  instanceof   EString )   +   ":" );
            
              System . out . print (   "s3"   +   ":" );  
              System . out . print ( s3 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s3 instanceof EBoolean"   +   ":"   +   (( Element ) s3  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EInteger"   +   ":"   +   (( Element ) s3  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s3 instanceof EString"   +   ":"   +   (( Element ) s3  instanceof   EString )   +   ":" );
            
              System . out . print (   "s4"   +   ":" );  
              System . out . print ( s4 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s4 instanceof EBoolean"   +   ":"   +   (( Element ) s4  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EInteger"   +   ":"   +   (( Element ) s4  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s4 instanceof EString"   +   ":"   +   (( Element ) s4  instanceof   EString )   +   ":" );
         }
         //check a bit more
         Element  x ;
        x  =  s1 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        x  =  i2 ;
        
              System . out . print (   "x"   +   ":" );  
              System . out . print ( x );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)x instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)x instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)x instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // did you need to copy EString's string?
         String  go  =   "Go" ;
         EString  g  =   new   EString ( go );
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        go  =  go  +   " figure" ;
         System . out . println ( go );
        
              System . out . print (   "g"   +   ":" );  
              System . out . print ( g );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)g instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)g instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)g instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         System . out . println (   "b1.hash()"   +   ":"   +   ( b1 . hash ())   +   ":" );
         System . out . println (   "b2.hash()"   +   ":"   +   ( b2 . hash ())   +   ":" );
         System . out . println (   "i1.hash()"   +   ":"   +   ( i1 . hash ())   +   ":" );
         System . out . println (   "i2.hash()"   +   ":"   +   ( i2 . hash ())   +   ":" );
         System . out . println (   "i3.hash()"   +   ":"   +   ( i3 . hash ())   +   ":" );
         System . out . println (   "s1.hash()"   +   ":"   +   ( s1 . hash ())   +   ":" );
         System . out . println (   "s2.hash()"   +   ":"   +   ( s2 . hash ())   +   ":" );
         System . out . println (   "s3.hash()"   +   ":"   +   ( s3 . hash ())   +   ":" );
         System . out . println (   "s4.hash()"   +   ":"   +   ( s4 . hash ())   +   ":" );
        x  =  s1 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
        x  =  i2 ;
         System . out . println (   "x.hash()"   +   ":"   +   ( x . hash ())   +   ":" );
         System . out . println (   "new EInteger(84).hash()"   +   ":"   +   ( new   EInteger ( 84 ). hash ())   +   ":" );
        
              System . out . print (   "Plus.plus(i3, i3)"   +   ":" );  
              System . out . print ( Plus . plus ( i3 ,  i3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i3, i3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i3 ,  i3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
         // mixed tests
        
              System . out . print (   "Plus.plus(i1, i2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  i2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, i2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  i2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s2)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, s3)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  s3 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, s3) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  s3 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s2, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s2 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s2, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s2 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s3, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s3 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s3, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s3 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, b2)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  b2 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, b2) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  b2 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(i1, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( i1 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(i1, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( i1 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, i1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s1, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s1 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s1, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s1 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s1)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(s4, b1)"   +   ":" );  
              System . out . print ( Plus . plus ( s4 ,  b1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(s4, b1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( s4 ,  b1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus(b2, s4)"   +   ":" );  
              System . out . print ( Plus . plus ( b2 ,  s4 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus(b2, s4) instanceof EString"   +   ":"   +   (( Element ) Plus . plus ( b2 ,  s4 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s1), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s1 ),  i1 )   instanceof   EString )   +   ":" );
        
              System . out . print (   "Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1)"   +   ":" );  
              System . out . print ( Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 ));  
              System . out . println ( ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EBoolean"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EInteger"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)Plus.plus( Plus.plus( Plus.plus(b1, i1), s2), i1) instanceof EString"   +   ":"   +   (( Element ) Plus . plus (   Plus . plus (   Plus . plus ( b1 ,  i1 ),  s2 ),  i1 )   instanceof   EString )   +   ":" );
         EString  s5  =   new   EString ( "hi" );
         EString  s6  =   new   EString ( "ok" );
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =  s6 ;
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
        s5  =   ( EString )( Plus . plus ( s6 ,  s6 ));
        
              System . out . print (   "s5"   +   ":" );  
              System . out . print ( s5 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s5 instanceof EBoolean"   +   ":"   +   (( Element ) s5  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EInteger"   +   ":"   +   (( Element ) s5  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s5 instanceof EString"   +   ":"   +   (( Element ) s5  instanceof   EString )   +   ":" );
        
              System . out . print (   "s6"   +   ":" );  
              System . out . print ( s6 );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)s6 instanceof EBoolean"   +   ":"   +   (( Element ) s6  instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EInteger"   +   ":"   +   (( Element ) s6  instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)s6 instanceof EString"   +   ":"   +   (( Element ) s6  instanceof   EString )   +   ":" );
         // make sure return type declared correctly
         Element  t ;
        t  =   Plus . plus ( b2 ,  b2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( i1 ,  i2 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
        t  =   Plus . plus ( s5 ,  s6 );
        
              System . out . print (   "t"   +   ":" );  
              System . out . print ( t );  
              System . out . println ( ":" );  
              System . out . println (   "(Element)t instanceof EBoolean"   +   ":"   +   (( Element ) instanceof   EBoolean )   +   ":" );  
              System . out . println (   "(Element)t instanceof EInteger"   +   ":"   +   (( Element ) instanceof   EInteger )   +   ":" );  
              System . out . println (   "(Element)t instanceof EString"   +   ":"   +   (( Element ) instanceof   EString )   +   ":" );
         // list stuff
         EList  l1  =   new   EList ();
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( i1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
        l1 . add ( b2 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         EList  l2  =   new   EList ();
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s4 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l2 . add ( s1 );
         System . out . println (   "l2.capacity()"   +   ":"   +   ( l2 . capacity ())   +   ":" );
         System . out . println (   "l2.size()"   +   ":"   +   ( l2 . size ())   +   ":" );
         System . out . println (   "l2"   );  
              System . out . println ( l2 );
        l1 . add ( b1 );
         System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
         System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
         System . out . println (   "l1"   );  
              System . out . println ( l1 );
         for   ( int  k  =   101 ;  k  <   120 ;  k ++ )   {
            l1 . add ( new   EInteger ( k ));
             System . out . println (   "l1.capacity()"   +   ":"   +   ( l1 . capacity ())   +   ":" );
             System . out . println (   "l1.size()"   +   ":"   +   ( l1 . size ())   +   ":" );
             System . out . println (   "l1"   );  
              System . out . println ( l1 );
         }
         EList  l3  =   new   EList ();
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b2 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
        l3 . add ( b1 );
         System . out . println (   "l3.capacity()"   +   ":"   +   ( l3 . capacity ())   +   ":" );
         System . out . println (   "l3.size()"   +   ":"   +   ( l3 . size ())   +   ":" );
         System . out . println (   "l3"   );  
              System . out . println ( l3 );
        countOut ();
         System . exit ( 0 );
     }
     private   static   void  countOut ()   {
         System . out . println (   "created "   +   Element . getCount ()   +   " Element" );
         System . out . println (   "created "   +   EBoolean . getCount ()   +   " EBoolean" );
         System . out . println (   "created "   +   EInteger . getCount ()   +   " EInteger" );
         System . out . println (   "created "   +   EString . getCount ()   +   " EString" );
     }
}