8e71c86c41ba0e3bcc805b26b2ee4d1de5df1eb8
[IRC.git] / Robust / src / Analysis / SSJava / DeltaLocation.java
1 package Analysis.SSJava;
2
3 import java.util.List;
4 import java.util.Vector;
5
6 import IR.ClassDescriptor;
7
8 public class DeltaLocation extends Location {
9
10   private Vector<Location> operandVec;
11
12   public DeltaLocation(ClassDescriptor cd) {
13     super(cd);
14     operandVec = new Vector<Location>();
15   }
16
17   public void addDeltaOperand(Location op) {
18     operandVec.add(op);
19   }
20
21   public List<Location> getDeltaOperandLocationVec() {
22     return operandVec;
23   }
24
25   public boolean equals(Object o) {
26
27     if (!(o instanceof DeltaLocation)) {
28       return false;
29     }
30
31     DeltaLocation deltaLoc = (DeltaLocation) o;
32
33     if (deltaLoc.getDeltaOperandLocationVec().equals(getDeltaOperandLocationVec())) {
34       return true;
35     }
36     return false;
37   }
38
39   public int hashCode() {
40     int hash = cd.hashCode();
41     if (loc != null) {
42       hash += operandVec.hashCode();
43     }
44     return hash;
45   }
46
47   public String toString() {
48     String rtr = "delta(";
49
50     int tupleSize = operandVec.size();
51     for (int i = 0; i < tupleSize; i++) {
52       Location locElement = operandVec.elementAt(i);
53       if (i != 0) {
54         rtr += ",";
55       }
56       rtr += locElement;
57     }
58     rtr += ")";
59     return rtr;
60   }
61
62 }