mp3decoder finally passes the flow-down rule checking.
[IRC.git] / Robust / src / Tests / Atomic4.java
1 public class Atomic4 extends Thread {
2         public People[] team;
3         public Atomic4() {
4         }
5         public static void main(String[] st) {
6                 int mid = (128<<24)|(195<<16)|(175<<8)|70;
7                 int b = 0,c = 0;
8                 
9                 Integer age;
10                 Atomic4 at4 = null;
11
12                 atomic {
13                         at4 = global new Atomic4();
14                         at4.team = global new People[2];
15                         at4.team[0] = global new People();
16                         at4.team[1] = global new People();
17                 }
18                 atomic { 
19                         age = global new Integer(35);
20                         at4.team[0].age = age;
21                         b = at4.team[0].getAge();
22                 }
23                 atomic {
24                         age = global new Integer(70);
25                         at4.team[1].age = age;
26                         c = at4.team[1].getAge();
27                 }
28                 System.printInt(b);
29                 System.printString("\n");
30                 System.printInt(c);
31                 System.printString("\n");
32                 System.printString("Starting\n");
33                 at4.start(mid);
34                 System.printString("Finished\n");
35                 while(true) {
36                         ;
37                 }
38         }
39
40         public int run() {
41                 int ag;
42                 boolean old = false;
43                 atomic {
44                         ag = team[1].getAge();
45                         //ag = team[0].getAge();
46                         if(ag > 65)
47                                 old = true;
48                 }
49                 if(old){
50                         System.printString("Gets Pension"); 
51                         System.printString("\n");
52                 } else {
53                         System.printString("Gets No Pension"); 
54                         System.printString("\n");
55                 }
56         }
57 }
58
59 public class People {
60         String name;
61         Integer age;
62
63         public People() {
64         }
65
66         public People(String name, Integer age) {
67                 this.name = name;
68                 this.age = age;
69         }
70
71         public void setName(String n) {
72                 name = n;
73         }
74         
75         public void setAge(Integer a) {
76                 age = a;
77         }
78
79         public String getName() {
80                 return name;
81         }
82
83         public int getAge() {
84                 return age.intValue();
85         }
86
87         public boolean isSenior() {
88                 if(this.getAge() > 65)
89                         return true;
90                 return false;
91         }
92 }