08462a32bfa6737eed1e80dc1515aadb6a27deaf
[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     
12     public ObjectSimulator(ClassDescriptor cd, FlagState currentFS) {
13         super();
14         this.cd = cd;
15         this.currentFS = currentFS;
16         this.changed = true;
17     }
18     
19     public void applyEdge(FEdge fedge) {
20         if(!currentFS.equals((FlagState)fedge.getTarget())) {
21             this.changed = true;
22             currentFS = (FlagState)fedge.getTarget();
23         } else {
24             this.changed = false;
25         }
26     }
27
28     public ClassDescriptor getCd() {
29         return cd;
30     }
31
32     public FlagState getCurrentFS() {
33         return currentFS;
34     }
35
36     public boolean isChanged() {
37         return changed;
38     }
39
40     public void setCurrentFS(FlagState currentFS) {
41         /*if(!this.currentFS.equals(currentFS)) {
42             changed = true;
43             this.currentFS = currentFS;
44         } else {
45             changed = false;
46         }*/
47         changed = true;
48         this.currentFS = currentFS;
49     }
50     
51 }