changes.
[IRC.git] / Robust / src / Analysis / OoOJava / WaitingElement.java
1 package Analysis.OoOJava;
2
3 import java.util.HashSet;
4 import java.util.Set;
5
6 import IR.Flat.TempDescriptor;
7
8 public class WaitingElement {
9
10   private int queueID;
11   private int status;
12   private String dynID = "";
13   private TempDescriptor tempDesc;
14
15   // if scc/coarse represents more than one waiting elements
16   // ignored waiting element is inserted into a set of waiting element as a bogus element
17   private boolean bogus = false;
18
19   // a set of tempDescriptors:
20   // all associated with coarse conflicts for the same queue and the same sese
21   private Set<TempDescriptor> tempSet;
22
23   public WaitingElement() {
24     tempSet = new HashSet<TempDescriptor>();
25   }
26
27   public void addTempDesc(TempDescriptor tempDesc) {
28     tempSet.add(tempDesc);
29   }
30
31   public Set<TempDescriptor> getTempDescSet() {
32     return tempSet;
33   }
34
35   public void setTempDesc(TempDescriptor tempDesc) {
36     this.tempDesc = tempDesc;
37   }
38
39   public TempDescriptor getTempDesc() {
40     return tempDesc;
41   }
42
43   public void setQueueID(int queueID) {
44     this.queueID = queueID;
45   }
46
47   public String getDynID() {
48     return dynID;
49   }
50
51   public void setDynID(String dynID) {
52     this.dynID = dynID;
53   }
54
55   public int getQueueID() {
56     return queueID;
57   }
58
59   public void setStatus(int status) {
60     this.status = status;
61   }
62
63   public int getStatus() {
64     return status;
65   }
66
67   public boolean equals(Object o) {
68
69     if (o == null) {
70       return false;
71     }
72
73     if (!(o instanceof WaitingElement)) {
74       return false;
75     }
76
77     WaitingElement in = (WaitingElement) o;
78
79     if (queueID == in.getQueueID() && status == in.getStatus() && dynID.equals(in.getDynID()) && tempDesc.equals(in.getTempDesc())) {
80       return true;
81     } else {
82       return false;
83     }
84
85   }
86
87   public String toString() {
88     return "[waitingID=" + queueID + " status=" + status + " dynID=" + dynID + " td= "+tempDesc+" isBogus="+ bogus+"]";
89   }
90
91   public int hashCode() {
92
93     int hash = 1;
94
95     hash = hash * 31 + queueID;
96
97     hash += status;
98
99     hash += dynID.hashCode();
100
101     return hash;
102
103   }
104
105   public boolean isBogus() {
106     return bogus;
107   }
108
109   public void setBogus(boolean b) {
110     bogus=b;
111   }
112
113 }