1 package Analysis.SSJava;
3 import java.util.HashSet;
6 import java.util.Vector;
8 import IR.ClassDescriptor;
9 import IR.TypeDescriptor;
11 public class DeltaLocation extends Location {
13 private Vector<Location> operandVec;
14 private TypeDescriptor refOperand = null;
16 public DeltaLocation(ClassDescriptor cd) {
18 operandVec = new Vector<Location>();
21 public DeltaLocation(ClassDescriptor cd, Set<Location> set) {
23 operandVec = new Vector<Location>();
24 operandVec.addAll(set);
27 public DeltaLocation(ClassDescriptor cd, TypeDescriptor refOperand) {
29 this.refOperand = refOperand;
30 operandVec = new Vector<Location>();
33 public TypeDescriptor getRefLocationId() {
34 return this.refOperand;
37 public void addDeltaOperand(Location op) {
41 public List<Location> getDeltaOperandLocationVec() {
45 public Set<Location> getBaseLocationSet() {
47 if (operandVec.size() == 1 && (operandVec.get(0) instanceof DeltaLocation)) {
48 // nested delta definition
49 DeltaLocation deltaLoc = (DeltaLocation) operandVec.get(0);
50 return deltaLoc.getBaseLocationSet();
52 Set<Location> set = new HashSet<Location>();
53 set.addAll(operandVec);
59 public boolean equals(Object o) {
61 if (!(o instanceof DeltaLocation)) {
65 DeltaLocation deltaLoc = (DeltaLocation) o;
67 if (deltaLoc.getDeltaOperandLocationVec().equals(getDeltaOperandLocationVec())) {
73 public int hashCode() {
74 int hash = cd.hashCode();
76 hash += operandVec.hashCode();
81 public String toString() {
82 String rtr = "delta(";
84 if (operandVec.size() != 0) {
85 int tupleSize = operandVec.size();
86 for (int i = 0; i < tupleSize; i++) {
87 Location locElement = operandVec.elementAt(i);