Fix another inner class bug: an inner class which is declared in a *static context...
[IRC.git] / Robust / src / Tests / Atomic5.java
index b93b71d331729a179bda8eaeef6910622ac95974..342744473e80ce0dc565e71e45c31e4ac658c24f 100644 (file)
@@ -1,3 +1,4 @@
+/* This test case tests the thread joining for a threadDSM library */ 
 public class Atomic5 extends Thread {
        public People[] team;
        public Atomic5() {
@@ -5,106 +6,90 @@ public class Atomic5 extends Thread {
        public static void main(String[] st) {
                int mid = (128<<24)|(195<<16)|(175<<8)|70;
                int b = 0,c = 0;
+               int i;
                
                Integer age;
-               String name;
                Atomic5 tmp;
                Atomic5[] at5;
+               
                atomic {
                        at5 =  global new Atomic5[4];
                }
                atomic {
-                       for(int i = 0; i < 4; i++) {
+                       for(i = 0; i < 4; i++) {
                                at5[i] = global new Atomic5();
                                at5[i].team = global new People[2];
                                at5[i].team[0] = global new People();
                                at5[i].team[1] = global new People();
                                age = global new Integer(35);
-                               name = global new String("Harry Potter");
-                               at5[i].team[0].name = name;
                                at5[i].team[0].age = age;
+                               at5[i].team[1].age = age;
                        }
                        b = at5[1].team[0].getAge();
                }
                System.printInt(b);
+               System.printString("\n");
                atomic {
                        age = global new Integer(70);
-                       name = global new String("John Smith");
-                       at5[1].team[1].name = name;
                        at5[1].team[1].age = age;
-                       c = at5[1].team[0].getAge();
+                       c = at5[1].team[1].getAge();
+                       //at5[20].team[1].age = age;
                }
                System.printInt(c);
                System.printString("\n");
                System.printString("Starting\n");
-               for(int i = 0 ; i< 4; i++) {
+               for(i = 0 ; i< 4; i++) {
                        atomic {
                                tmp = at5[i];
                        }
                        tmp.start(mid);
                }
-               for(int i = 0; i< 4; i++) {
+               for(i = 0; i< 4; i++) {
                        atomic {
                                tmp = at5[i];
                        }
                        tmp.join();
                }
                System.printString("Finished\n");
+               /*
                while(true) {
                        ;
                }
+               */
        }
 
        public void run() {
-               /*
-               String newname = "";
                int ag;
                boolean old = false;
                atomic {
                        ag = team[1].getAge();
-                       newname = team[1].getName();
                        if(ag > 65)
                                old = true;
                }
                if(old){
-                       System.printString(" gets Pension"); 
+                       System.printString("Gets Pension"); 
+                       System.printString("\n");
+               } else {
+                       System.printString("Gets No Pension"); 
                        System.printString("\n");
                }
-               */
-               System.printString("Atomic5() Inside the run program"); 
-               System.printString("\n");
-               /*
-               for(int i=0; i<4 ; i++) {
-                       at5[i].join();
-               }
-               */
        }
 }
 
 public class People {
-       String name;
        Integer age;
 
        public People() {
        }
 
-       public People(String name, Integer age) {
-               this.name = name;
+       public People(Integer age) {
                this.age = age;
        }
 
-       public void setName(String n) {
-               name = n;
-       }
-       
        public void setAge(Integer a) {
                age = a;
        }
 
-       public String getName() {
-               return name;
-       }
-
        public int getAge() {
                return age.intValue();
        }