changes.
[IRC.git] / Robust / src / Analysis / SSJava / Family.java
1 package Analysis.SSJava;
2
3 import java.util.HashMap;
4 import java.util.HashSet;
5 import java.util.Iterator;
6 import java.util.Map;
7 import java.util.Set;
8
9 public class Family {
10
11   // an element of the family is represented by a pair (basis,set of corresponding nodes)
12   Map<Set<Integer>, Set<HNode>> mapFtoGammaF;
13
14   Set<Set<Integer>> Fset;
15
16   public static Set<Integer> EMPTY = new HashSet<Integer>();
17
18   public Family() {
19     Fset = new HashSet<Set<Integer>>();
20     Fset.add(EMPTY);
21     mapFtoGammaF = new HashMap<Set<Integer>, Set<HNode>>();
22   }
23
24   public void addFElement(Set<Integer> F) {
25     Fset.add(F);
26   }
27
28   public Set<HNode> getGamma(Set<Integer> F) {
29     if (!mapFtoGammaF.containsKey(F)) {
30       mapFtoGammaF.put(F, new HashSet<HNode>());
31     }
32     return mapFtoGammaF.get(F);
33   }
34
35   public void updateGammaF(Set<Integer> F, Set<HNode> gamma) {
36     getGamma(F).addAll(gamma);
37   }
38
39   public boolean containsF(Set<Integer> F) {
40     return Fset.contains(F);
41   }
42
43   public int size() {
44     return Fset.size();
45   }
46
47   public Iterator<Set<Integer>> FIterator() {
48     return Fset.iterator();
49   }
50
51   public String toString() {
52
53     return mapFtoGammaF.toString();
54
55   }
56
57 }