6850960485f676def5fdab549dd21111e98d8c01
[IRC.git] / Robust / src / Analysis / SSJava / NodeTupleSet.java
1 package Analysis.SSJava;
2
3 import java.util.HashSet;
4 import java.util.Iterator;
5 import java.util.Set;
6
7 import IR.Descriptor;
8
9 public class NodeTupleSet {
10
11   private Set<NTuple<Descriptor>> set;
12
13   public NodeTupleSet() {
14     set = new HashSet<NTuple<Descriptor>>();
15   }
16
17   public void addTuple(NTuple<Descriptor> tuple) {
18
19     // need to add additional elements because we need to create edges even from
20     // the base
21     // for example, if we have input <a,b,c>, we need to add additional element
22     // <a,b> and <a> to the set
23
24     // NTuple<Descriptor> cur = new NTuple<Descriptor>();
25     // for (int i = 0; i < tuple.size(); i++) {
26     // Descriptor d = tuple.get(i);
27     // cur.add(d);
28     // set.add(new NTuple<Descriptor>(cur));
29     // }
30
31     set.add(tuple);
32   }
33
34   public Iterator<NTuple<Descriptor>> iterator() {
35     return set.iterator();
36   }
37
38   public String toString() {
39     return set.toString();
40   }
41
42   public Set<NTuple<Descriptor>> getSet() {
43     return set;
44   }
45
46   public void addTupleSet(NodeTupleSet in) {
47     if (in != null) {
48       set.addAll(in.getSet());
49     }
50   }
51 }