1 package Analysis.SSJava;
3 import java.util.HashSet;
4 import java.util.Hashtable;
7 public class MultiSourceMap<T, V> {
9 Hashtable<T, Set<V>> map;
11 public MultiSourceMap() {
12 map = new Hashtable<T, Set<V>>();
15 public void put(T key, Set<V> set) {
19 public void put(T key, T setKey, Set<V> set) {
21 if (!map.containsKey(setKey)) {
27 public void put(T key, T setKey, V value) {
30 if (map.containsKey(key)) {
31 Set<V> set = map.get(key);
35 Set<V> set = new HashSet<V>();
40 assert map.containsKey(setKey);
41 Set<V> set = map.get(setKey);
47 public Set<V> get(T key) {
51 public String toString() {
52 return map.toString();
56 public Set<T> keySet() {
60 public void union(T newKey, Set<V> writeSet) {
62 if (map.containsKey(newKey)) {
63 map.get(newKey).addAll(writeSet);
65 put(newKey, writeSet);