Add multi-parameter tasks support in Scheduling Simulator
[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         /*if(!this.currentFS.equals(currentFS)) {
48             changed = true;
49             this.currentFS = currentFS;
50         } else {
51             changed = false;
52         }*/
53         changed = true;
54         this.currentFS = currentFS;
55     }
56
57     public boolean isHold() {
58         return hold;
59     }
60
61     public void setHold(boolean hold) {
62         this.hold = hold;
63     }
64
65     public boolean isShared() {
66         return shared;
67     }
68
69     public void setShared(boolean shared) {
70         this.shared = shared;
71     }
72
73     public int getVersion() {
74         return version;
75     }
76
77     public void increaseVersion() {
78         this.version++;
79     }
80 }