changes: now Inference engine works fine with the EyeTracking benchmark.
[IRC.git] / Robust / src / Analysis / SSJava / DeltaLocation.java
1 package Analysis.SSJava;
2
3 public class DeltaLocation extends CompositeLocation {
4
5   private int numDelta;
6
7   public DeltaLocation() {
8     super();
9   }
10
11   public DeltaLocation(CompositeLocation comp, int numDelta) {
12     super();
13     this.numDelta = numDelta;
14     this.locTuple.addAll(comp.getTuple());
15   }
16
17   public int getNumDelta() {
18     return numDelta;
19   }
20
21   public void setNumDelta(int d) {
22     numDelta = d;
23   }
24
25   public String toString() {
26
27     String rtr = "";
28     for (int i = 0; i < numDelta; i++) {
29       rtr += "DELTA[";
30     }
31
32     int tupleSize = locTuple.size();
33     for (int i = 0; i < tupleSize; i++) {
34       Location locElement = locTuple.get(i);
35       if (i != 0) {
36         rtr += ",";
37       }
38       rtr += locElement;
39     }
40
41     for (int i = 0; i < numDelta; i++) {
42       rtr += "]";
43     }
44
45     return rtr;
46   }
47
48   public CompositeLocation clone() {
49     DeltaLocation clone = new DeltaLocation();
50     clone.getTuple().addAll(locTuple);
51     clone.setNumDelta(numDelta);
52     return clone;
53   }
54
55   public boolean equals(Object o) {
56
57     if (!(o instanceof DeltaLocation)) {
58       return false;
59     }
60
61     DeltaLocation deltaLoc = (DeltaLocation) o;
62
63     if (deltaLoc.getTuple().equals(getTuple()) && deltaLoc.getNumDelta() == numDelta) {
64       return true;
65     } else {
66       return false;
67     }
68
69   }
70
71   public int hashCode() {
72     return locTuple.hashCode() + numDelta;
73   }
74
75 }