public void addWrite(NTuple<Location> locTuple, Set<NTuple<Descriptor>> hpSet) {
- Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
- if (writeSet == null) {
- writeSet = new HashSet<NTuple<Descriptor>>();
- map.put(locTuple, writeSet);
+ if (hpSet != null) {
+ Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
+ if (writeSet == null) {
+ writeSet = new HashSet<NTuple<Descriptor>>();
+ map.put(locTuple, writeSet);
+ }
+ writeSet.addAll(hpSet);
}
- writeSet.addAll(hpSet);
+
}
public void addWrite(NTuple<Location> locTuple, NTuple<Descriptor> hp) {
- Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
- if (writeSet == null) {
- writeSet = new HashSet<NTuple<Descriptor>>();
- map.put(locTuple, writeSet);
+ if (hp != null) {
+ Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
+ if (writeSet == null) {
+ writeSet = new HashSet<NTuple<Descriptor>>();
+ map.put(locTuple, writeSet);
+ }
+ writeSet.add(hp);
}
- writeSet.add(hp);
+
+ }
+
+ public void intersect(NTuple<Location> locTuple, Set<NTuple<Descriptor>> hpSet) {
+
+ Set<NTuple<Descriptor>> set = map.get(locTuple);
+ if (set == null) {
+ set = new HashSet<NTuple<Descriptor>>();
+ map.put(locTuple, set);
+ set.addAll(hpSet);
+ }
+
+ set.addAll(hpSet);
+
}
public void removeWrite(NTuple<Location> locTuple, NTuple<Descriptor> hp) {
}
}
+ public void removeWriteAll(NTuple<Location> locTuple, Set<NTuple<Descriptor>> hpSet) {
+
+ if(hpSet!=null){
+ Set<NTuple<Descriptor>> writeSet = map.get(locTuple);
+ if (writeSet != null) {
+ writeSet.removeAll(hpSet);
+ }
+ }
+
+ }
+
public String toString() {
return map.toString();
}
}
}
+ public void clear() {
+ map.clear();
+ }
+
+ public SharedLocMap getHeapPathStartedWith(NTuple<Location> locTuple) {
+
+ SharedLocMap rtrSet = new SharedLocMap();
+
+ Set<NTuple<Location>> keySet = map.keySet();
+ for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
+ NTuple<Location> key = (NTuple<Location>) iterator.next();
+ if (key.startsWith(locTuple)) {
+ rtrSet.addWrite(key, map.get(key));
+ }
+ }
+ return rtrSet;
+
+ }
+
}