changes to reflect ssjava design changes and temporarily remove some of ssjava class...
[IRC.git] / Robust / src / Analysis / SSJava / DeltaLocation.java
1 package Analysis.SSJava;
2
3 import IR.ClassDescriptor;
4 import IR.Descriptor;
5
6 public class DeltaLocation extends CompositeLocation {
7
8   private Descriptor refOperand = null;
9   private int numDelta;
10
11   public DeltaLocation() {
12   }
13
14   // public DeltaLocation(Set<Location> set) {
15   // locTuple.addAll(set);
16   // }
17
18   public DeltaLocation(ClassDescriptor cd, Descriptor refOperand) {
19     this.refOperand = refOperand;
20   }
21
22   public Descriptor getRefLocationId() {
23     return this.refOperand;
24   }
25
26   public void addDeltaOperand(Location op) {
27     locTuple.addElement(op);
28   }
29
30   public NTuple<Location> getDeltaOperandLocationVec() {
31     return locTuple;
32   }
33
34   // public Set<Location> getBaseLocationSet() {
35   //
36   // if (operandVec.size() == 1 && (operandVec.get(0) instanceof DeltaLocation))
37   // {
38   // // nested delta definition
39   // DeltaLocation deltaLoc = (DeltaLocation) operandVec.get(0);
40   // return deltaLoc.getBaseLocationSet();
41   // } else {
42   // Set<Location> set = new HashSet<Location>();
43   // set.addAll(operandVec);
44   // return set;
45   // }
46   //
47   // }
48
49   public boolean equals(Object o) {
50
51     if (!(o instanceof DeltaLocation)) {
52       return false;
53     }
54
55     DeltaLocation deltaLoc = (DeltaLocation) o;
56
57     if (deltaLoc.getDeltaOperandLocationVec().equals(getDeltaOperandLocationVec())) {
58       return true;
59     }
60     return false;
61   }
62
63   public int hashCode() {
64     int hash = locTuple.hashCode();
65     if (refOperand != null) {
66       hash += refOperand.hashCode();
67     }
68     return hash;
69   }
70
71   public String toString() {
72     String rtr = "delta(";
73
74     if (locTuple.size() != 0) {
75       int tupleSize = locTuple.size();
76       for (int i = 0; i < tupleSize; i++) {
77         Location locElement = locTuple.get(i);
78         if (i != 0) {
79           rtr += ",";
80         }
81         rtr += locElement;
82       }
83     } else {
84       rtr += "LOC_REF";
85     }
86
87     rtr += ")";
88
89     return rtr;
90   }
91
92 }