it has passed test cases
[IRC.git] / Robust / src / Analysis / SSJava / SharedLocMap.java
index 863ea95ba7261e4a75fa150305928ef3774aa78a..d7efa55b3c5ea57ae1faecd9f5e2131aed4a1008 100644 (file)
@@ -84,8 +84,8 @@ public class SharedLocMap {
   }
 
   public void removeWriteAll(NTuple<Location> locTuple, Set<NTuple<Descriptor>> hpSet) {
-    
-    if(hpSet!=null){
+
+    if (hpSet != null) {
       Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
       if (writeSet != null) {
         writeSet.removeAll(hpSet);
@@ -137,4 +137,16 @@ public class SharedLocMap {
 
   }
 
+  public boolean containsElement(NTuple<Descriptor> heapPath) {
+
+    Set<NTuple<Location>> locTupleSet = map.keySet();
+    for (Iterator iterator = locTupleSet.iterator(); iterator.hasNext();) {
+      NTuple<Location> locTuple = (NTuple<Location>) iterator.next();
+      if (map.get(locTuple).contains(heapPath)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
 }