change to new scheduling search algorithm: search part of the whole space -> simulate...
[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   static int objid = 0;
9   
10   int oid;
11   ClassDescriptor cd;
12   FlagState currentFS;
13   boolean changed;
14   boolean shared;
15   boolean hold;
16   int version;
17
18   public ObjectSimulator(ClassDescriptor cd, 
19                          FlagState currentFS) {
20     super();
21     this.oid = ObjectSimulator.objid++;
22     this.cd = cd;
23     this.currentFS = currentFS;
24     this.changed = true;
25     this.shared = false;
26     this.hold = false;
27     this.version = 0;
28   }
29
30   public void applyEdge(FEdge fedge) {
31     if(!currentFS.equals((FlagState)fedge.getTarget())) {
32       this.changed = true;
33       currentFS = (FlagState)fedge.getTarget();
34     } else {
35       this.changed = false;
36     }
37   }
38
39   public int getOid() {
40     return oid;
41   }
42
43   public ClassDescriptor getCd() {
44     return cd;
45   }
46
47   public FlagState getCurrentFS() {
48     return currentFS;
49   }
50
51   public boolean isChanged() {
52     return changed;
53   }
54
55   public void setCurrentFS(FlagState currentFS) {
56     changed = true;
57     this.currentFS = currentFS;
58   }
59
60   public boolean isHold() {
61     return hold;
62   }
63
64   public void setHold(boolean hold) {
65     this.hold = hold;
66   }
67
68   public boolean isShared() {
69     return shared;
70   }
71
72   public void setShared(boolean shared) {
73     this.shared = shared;
74   }
75
76   public int getVersion() {
77     return version;
78   }
79
80   public void increaseVersion() {
81     this.version++;
82   }
83 }