changes: now Inference engine works fine with the EyeTracking benchmark.
[IRC.git] / Robust / src / Analysis / SSJava / GlobalFlowNode.java
1 package Analysis.SSJava;
2
3 import IR.Descriptor;
4
5 public class GlobalFlowNode {
6
7   NTuple<Location> locTuple;
8   CompositeLocation compLoc;
9   boolean isParamNodeWithIncomingFlows;
10
11   public GlobalFlowNode(NTuple<Location> in) {
12     locTuple = in;
13     isParamNodeWithIncomingFlows = false;
14   }
15
16   public void setParamNodeWithIncomingFlows(boolean in) {
17     isParamNodeWithIncomingFlows = in;
18   }
19
20   public boolean isParamNodeWithIncomingFlows() {
21     return isParamNodeWithIncomingFlows;
22   }
23
24   public int hashCode() {
25     return locTuple.hashCode();
26   }
27
28   public NTuple<Location> getLocTuple() {
29     return locTuple;
30   }
31
32   public boolean equals(Object obj) {
33
34     if (obj instanceof GlobalFlowNode) {
35       GlobalFlowNode in = (GlobalFlowNode) obj;
36       if (locTuple.equals(in.getLocTuple())) {
37         return true;
38       }
39     }
40
41     return false;
42
43   }
44
45   public String toString() {
46     return locTuple.toString();
47   }
48
49   public NTuple<Descriptor> getDescTuple() {
50     NTuple<Descriptor> descTuple = new NTuple<Descriptor>();
51
52     for (int i = 0; i < locTuple.size(); i++) {
53       descTuple.add(locTuple.get(i).getLocDescriptor());
54     }
55
56     return descTuple;
57   }
58
59   public String getID() {
60
61     NTuple<Descriptor> descTuple = getDescTuple();
62     String id = "";
63     for (int i = 0; i < descTuple.size(); i++) {
64       id += descTuple.get(i).getSymbol();
65     }
66     return id;
67   }
68
69   public void setInferCompositeLocation(CompositeLocation in) {
70     this.compLoc = in;
71   }
72
73   public CompositeLocation getInferCompositeLocation() {
74     return compLoc;
75   }
76
77   public String getPrettyID() {
78
79     NTuple<Descriptor> descTuple = getDescTuple();
80
81     String id = "<";
82     String property = "";
83     for (int i = 0; i < descTuple.size(); i++) {
84       if (i == 0) {
85         id += locTuple.get(i);
86       } else {
87         id += ",";
88         id += descTuple.get(i).getSymbol();
89       }
90     }
91     id += ">";
92
93     if (compLoc != null) {
94       id += " " + compLoc;
95     }
96
97     // if (isReturn()) {
98     // property += "R";
99     // }
100     //
101     // if (isSkeleton()) {
102     // property += "S";
103     // }
104
105     if (property.length() > 0) {
106       property = " [" + property + "]";
107     }
108
109     return id + property;
110   }
111
112 }