changes.
[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
10   public GlobalFlowNode(NTuple<Location> in) {
11     locTuple = in;
12     if (in.size() == 0) {
13       throw new Error();
14     }
15   }
16
17   public int hashCode() {
18     return locTuple.hashCode();
19   }
20
21   public NTuple<Location> getLocTuple() {
22     return locTuple;
23   }
24
25   public boolean equals(Object obj) {
26
27     if (obj instanceof GlobalFlowNode) {
28       GlobalFlowNode in = (GlobalFlowNode) obj;
29       if (locTuple.equals(in.getLocTuple())) {
30         return true;
31       }
32     }
33
34     return false;
35
36   }
37
38   public String toString() {
39     return locTuple.toString();
40   }
41
42   public NTuple<Descriptor> getDescTuple() {
43     NTuple<Descriptor> descTuple = new NTuple<Descriptor>();
44
45     for (int i = 0; i < locTuple.size(); i++) {
46       descTuple.add(locTuple.get(i).getLocDescriptor());
47     }
48
49     return descTuple;
50   }
51
52   public String getID() {
53
54     NTuple<Descriptor> descTuple = getDescTuple();
55     String id = "";
56     for (int i = 0; i < descTuple.size(); i++) {
57       id += descTuple.get(i).getSymbol();
58     }
59     return id;
60   }
61
62   public void setInferCompositeLocation(CompositeLocation in) {
63     this.compLoc = in;
64   }
65
66   public CompositeLocation getInferCompositeLocation() {
67     return compLoc;
68   }
69
70   public String getPrettyID() {
71
72     NTuple<Descriptor> descTuple = getDescTuple();
73
74     String id = "<";
75     String property = "";
76     for (int i = 0; i < descTuple.size(); i++) {
77       if (i == 0) {
78         id += locTuple.get(i);
79       } else {
80         id += ",";
81         id += descTuple.get(i).getSymbol();
82       }
83     }
84     id += ">";
85
86     if (compLoc != null) {
87       id += " " + compLoc;
88     }
89
90     // if (isReturn()) {
91     // property += "R";
92     // }
93     //
94     // if (isSkeleton()) {
95     // property += "S";
96     // }
97
98     if (property.length() > 0) {
99       property = " [" + property + "]";
100     }
101
102     return id + property;
103   }
104
105 }