changes.
[IRC.git] / Robust / src / Analysis / SSJava / FlowEdge.java
1 package Analysis.SSJava;
2
3 import IR.Descriptor;
4
5 public class FlowEdge {
6
7   private FlowNode src;
8   private FlowNode dst;
9
10   // indicates that which tuple in the graph initiates this edge
11   private NTuple<Descriptor> initTuple;
12
13   // indicates that which tuple in the graph is the end of this edge
14   private NTuple<Descriptor> endTuple;
15
16   public FlowEdge(FlowNode src, FlowNode dst, NTuple<Descriptor> initTuple,
17       NTuple<Descriptor> endTuple) {
18     this.src = src;
19     this.dst = dst;
20     this.initTuple = initTuple;
21     this.endTuple = endTuple;
22   }
23
24   public String toString() {
25     return "Edge(" + initTuple + "/" + endTuple + "):: " + src + " to " + dst;
26   }
27
28   public FlowNode getSrc() {
29     return src;
30   }
31
32   public void setSrc(FlowNode src) {
33     this.src = src;
34   }
35
36   public FlowNode getDst() {
37     return dst;
38   }
39
40   public void setDst(FlowNode dst) {
41     this.dst = dst;
42   }
43
44   public NTuple<Descriptor> getInitTuple() {
45     return initTuple;
46   }
47
48   public void setInitTuple(NTuple<Descriptor> initTuple) {
49     this.initTuple = initTuple;
50   }
51
52   public void setEndTuple(NTuple<Descriptor> endTuple) {
53     this.endTuple = endTuple;
54   }
55
56   public int hashCode() {
57     return src.hashCode() + dst.hashCode() + initTuple.hashCode() + endTuple.hashCode();
58   }
59
60   public NTuple<Descriptor> getEndTuple() {
61     return endTuple;
62   }
63
64   public boolean equals(Object obj) {
65
66     if (obj instanceof FlowEdge) {
67       FlowEdge in = (FlowEdge) obj;
68       if (src.equals(in.getSrc()) && dst.equals(in.getDst()) && initTuple.equals(in.getInitTuple())
69           && endTuple.equals(in.getEndTuple())) {
70         return true;
71       }
72     }
73
74     return false;
75   }
76
77 }