having new variable 'inter' in-between "reorder/antialias" and "hybrid" in order...
[IRC.git] / Robust / src / Tests / Atomic5.java
1 /* This test case tests the thread joining for a threadDSM library */ 
2 public class Atomic5 extends Thread {
3         public People[] team;
4         public Atomic5() {
5         }
6         public static void main(String[] st) {
7                 int mid = (128<<24)|(195<<16)|(175<<8)|70;
8                 int b = 0,c = 0;
9                 int i;
10                 
11                 Integer age;
12                 Atomic5 tmp;
13                 Atomic5[] at5;
14                 
15                 atomic {
16                         at5 =  global new Atomic5[4];
17                 }
18                 atomic {
19                         for(i = 0; i < 4; i++) {
20                                 at5[i] = global new Atomic5();
21                                 at5[i].team = global new People[2];
22                                 at5[i].team[0] = global new People();
23                                 at5[i].team[1] = global new People();
24                                 age = global new Integer(35);
25                                 at5[i].team[0].age = age;
26                                 at5[i].team[1].age = age;
27                         }
28                         b = at5[1].team[0].getAge();
29                 }
30                 System.printInt(b);
31                 System.printString("\n");
32                 atomic {
33                         age = global new Integer(70);
34                         at5[1].team[1].age = age;
35                         c = at5[1].team[1].getAge();
36                         //at5[20].team[1].age = age;
37                 }
38                 System.printInt(c);
39                 System.printString("\n");
40                 System.printString("Starting\n");
41                 for(i = 0 ; i< 4; i++) {
42                         atomic {
43                                 tmp = at5[i];
44                         }
45                         tmp.start(mid);
46                 }
47                 for(i = 0; i< 4; i++) {
48                         atomic {
49                                 tmp = at5[i];
50                         }
51                         tmp.join();
52                 }
53                 System.printString("Finished\n");
54                 /*
55                 while(true) {
56                         ;
57                 }
58                 */
59         }
60
61         public void run() {
62                 int ag;
63                 boolean old = false;
64                 atomic {
65                         ag = team[1].getAge();
66                         if(ag > 65)
67                                 old = true;
68                 }
69                 if(old){
70                         System.printString("Gets Pension"); 
71                         System.printString("\n");
72                 } else {
73                         System.printString("Gets No Pension"); 
74                         System.printString("\n");
75                 }
76         }
77 }
78
79 public class People {
80         Integer age;
81
82         public People() {
83         }
84
85         public People(Integer age) {
86                 this.age = age;
87         }
88
89         public void setAge(Integer a) {
90                 age = a;
91         }
92
93         public int getAge() {
94                 return age.intValue();
95         }
96
97         public boolean isSenior() {
98                 if(this.getAge() > 65)
99                         return true;
100                 return false;
101         }
102 }