Fix tabbing.... Please fix your editors so they do tabbing correctly!!! (Spaces...
[IRC.git] / Robust / src / Analysis / SSJava / Location.java
index 11c3f08652db04d8eaae2cf13cf704f2a2b2b0c0..decaee7c0b4fec7fe648437e817a5ab8bc0db1e4 100644 (file)
@@ -1,12 +1,14 @@
 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;
 
   int type;
   ClassDescriptor 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;
+       }
       }
     }
 
@@ -74,4 +76,22 @@ public class Location {
     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;
+  }
+
 }