run ooojava and rcrpointer that print out effects and annotate them with the source...
[IRC.git] / Robust / src / Analysis / Pointer / Util.java
1 package Analysis.Pointer;
2 import java.util.HashSet;
3 import java.util.HashMap;
4 import java.util.Set;
5
6 public class Util {
7   public static <T> MySet<T> setSubtract(Set <T> orig, Set<T> sub) {
8     MySet<T> newset=new MySet<T>();
9     for(T e : orig) {
10       if (!sub.contains(e))
11         newset.add(e);
12     }
13     return newset;
14   }
15
16   public static <K,V> void relationUpdate(HashMap<K,MySet<V>> map, K key, MySet<V> toremove, MySet<V> toadd) {
17     if (map.containsKey(key)) {
18       if (toremove!=null)
19         map.get(key).removeAll(toremove);
20       map.get(key).addAll(toadd);
21     } else {
22       if (toadd!=null)
23         map.put(key, (MySet<V>)toadd.clone());
24     }
25   }
26
27 }