Fix tabbing.... Please fix your editors so they do tabbing correctly!!! (Spaces...
[IRC.git] / Robust / src / Analysis / SSJava / Location.java
index ca0ec5a050de9d1650d38a3ff2c5195c5e966341..decaee7c0b4fec7fe648437e817a5ab8bc0db1e4 100644 (file)
@@ -1,16 +1,18 @@
 package Analysis.SSJava;
 
 import IR.ClassDescriptor;
+import IR.TypeExtension;
 
-public class Location {
+public class Location  implements TypeExtension {
 
   public static final int TOP = 1;
   public static final int NORMAL = 2;
   public static final int BOTTOM = 3;
+  public static final int DELTA = 4;
 
-  private int type;
-  private ClassDescriptor cd;
-  private String loc;
+  int type;
+  ClassDescriptor cd;
+  String loc;
 
   public Location(ClassDescriptor cd, String loc) {
     this.cd = cd;
@@ -47,13 +49,13 @@ public class Location {
 
     if (loc.getClassDescriptor().equals(getClassDescriptor())) {
       if (loc.getLocIdentifier() == null || getLocIdentifier() == null) {
-        if (loc.getType() == getType()) {
-          return true;
-        }
+       if (loc.getType() == getType()) {
+         return true;
+       }
       } else {
-        if (loc.getLocIdentifier().equals(getLocIdentifier())) {
-          return true;
-        }
+       if (loc.getLocIdentifier().equals(getLocIdentifier())) {
+         return true;
+       }
       }
     }
 
@@ -70,4 +72,26 @@ public class Location {
 
   }
 
+  public String toString() {
+    return "Loc[" + cd.getSymbol() + "." + loc + "]";
+  }
+
+  public static Location createTopLocation(ClassDescriptor cd) {
+    Location topLoc = new Location(cd);
+    topLoc.setType(TOP);
+    topLoc.loc = "_top_";
+    return topLoc;
+  }
+
+  public static Location createBottomLocation(ClassDescriptor cd) {
+    Location bottomLoc = new Location(cd);
+    bottomLoc.setType(BOTTOM);
+    bottomLoc.loc = "_bottom_";
+    return bottomLoc;
+  }
+
+  public boolean isTop() {
+    return type==TOP;
+  }
+
 }