start of new file
[IRC.git] / Robust / src / Analysis / Scheduling / ObjectSimulator.java
1 package Analysis.Scheduling;
2
3 import Analysis.TaskStateAnalysis.FEdge;
4 import Analysis.TaskStateAnalysis.FlagState;
5 import IR.ClassDescriptor;
6
7 public class ObjectSimulator {
8     ClassDescriptor cd;
9     FlagState currentFS;
10     boolean changed;
11     boolean shared;
12     boolean hold;
13     int version;
14     
15     public ObjectSimulator(ClassDescriptor cd, FlagState currentFS) {
16         super();
17         this.cd = cd;
18         this.currentFS = currentFS;
19         this.changed = true;
20         this.shared = false;
21         this.hold = false;
22         this.version = 0;
23     }
24     
25     public void applyEdge(FEdge fedge) {
26         if(!currentFS.equals((FlagState)fedge.getTarget())) {
27             this.changed = true;
28             currentFS = (FlagState)fedge.getTarget();
29         } else {
30             this.changed = false;
31         }
32     }
33
34     public ClassDescriptor getCd() {
35         return cd;
36     }
37
38     public FlagState getCurrentFS() {
39         return currentFS;
40     }
41
42     public boolean isChanged() {
43         return changed;
44     }
45
46     public void setCurrentFS(FlagState currentFS) {
47         changed = true;
48         this.currentFS = currentFS;
49     }
50
51     public boolean isHold() {
52         return hold;
53     }
54
55     public void setHold(boolean hold) {
56         this.hold = hold;
57     }
58
59     public boolean isShared() {
60         return shared;
61     }
62
63     public void setShared(boolean shared) {
64         this.shared = shared;
65     }
66
67     public int getVersion() {
68         return version;
69     }
70
71     public void increaseVersion() {
72         this.version++;
73     }
74 }