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