switch to spaces only..
[IRC.git] / Robust / src / Analysis / Locality / LocalityBinding.java
index 132bdfb68a82a4ff74608634e48544f4235aa672..3da793fc0b7caad568eac8eeab2f7dd4217e888b 100644 (file)
@@ -35,7 +35,15 @@ public class LocalityBinding {
       return "E";
     else if (g==LocalityAnalysis.CONFLICT)
       return "C";
-    else throw new Error();
+    else if (g==LocalityAnalysis.SCRATCH)
+      return "S";
+    else if (g==LocalityAnalysis.NORMAL)
+      return "R";
+    else if (g==(LocalityAnalysis.STMCONFLICT))
+      return "C";
+    else if (g==(LocalityAnalysis.STMEITHER))
+      return "E";
+    else throw new Error("unknown value"+g);
   }
 
   public String getSignature() {
@@ -75,23 +83,29 @@ public class LocalityBinding {
       st+="[static] ";
     } else {
       if (isglobalthis.equals(LocalityAnalysis.LOCAL))
-       st+="[local] ";
+        st+="[local] ";
       else if (isglobalthis.equals(LocalityAnalysis.GLOBAL))
-       st+="[global] ";
+        st+="[global] ";
       else if (isglobalthis.equals(LocalityAnalysis.EITHER))
-       st+="[either] ";
+        st+="[either] ";
       else if (isglobalthis.equals(LocalityAnalysis.CONFLICT))
-       st+="[conflict] ";
+        st+="[conflict] ";
+      else
+        st+="[this="+isglobalthis+"]";
     }
     for(int i=0; i<isglobal.length; i++)
-      if (isglobal[i].equals(LocalityAnalysis.LOCAL))
-       st+="local ";
+      if (isglobal[i]==null)
+        st+="NULL";
+      else if (isglobal[i].equals(LocalityAnalysis.LOCAL))
+        st+="local ";
       else if (isglobal[i].equals(LocalityAnalysis.GLOBAL))
-       st+="global ";
+        st+="global ";
       else if (isglobal[i].equals(LocalityAnalysis.EITHER))
-       st+="either ";
+        st+="either ";
       else if (isglobal[i].equals(LocalityAnalysis.CONFLICT))
-       st+="conflict ";
+        st+="conflict ";
+      else
+        st+="["+isglobal[i]+"]";
     return st;
   }
 
@@ -132,7 +146,7 @@ public class LocalityBinding {
       return false;
     for(int i=0; i<isglobal.length; i++)
       if (!equiv(isglobal[i],lb.isglobal[i]))
-       return false;
+        return false;
 
     if (!equiv(isglobalthis, lb.isglobalthis))
       return false;
@@ -143,8 +157,7 @@ public class LocalityBinding {
     if (a==null) {
       return b==null;
     } else if (b==null) {
-      //a is not null
-      return false;
+      return a==null;
     } else return a.equals(b);
   }
 
@@ -152,14 +165,14 @@ public class LocalityBinding {
     if (o instanceof LocalityBinding) {
       LocalityBinding lb=(LocalityBinding)o;
       if (md!=lb.md)
-       return false;
+        return false;
 
       for(int i=0; i<isglobal.length; i++)
-       if (!equiv(isglobal[i], lb.isglobal[i]))
-         return false;
+        if (!equiv(isglobal[i], lb.isglobal[i]))
+          return false;
 
       if (!equiv(isglobalthis, lb.isglobalthis))
-       return false;
+        return false;
       return (isatomic==lb.isatomic);
     }
     return false;
@@ -169,9 +182,9 @@ public class LocalityBinding {
     int hashcode=md.hashCode();
     for(int i=0; i<isglobal.length; i++) {
       if (isglobal[i]!=null)
-       hashcode=hashcode*31+(isglobal[i].intValue());
+        hashcode=hashcode*31+(isglobal[i].intValue());
     }
-    hashcode=hashcode*31+(isatomic ? 1 : 0);
+    hashcode=hashcode*31+(isatomic?1:0);
     return hashcode;
   }
 }