having new variable 'inter' in-between "reorder/antialias" and "hybrid" in order...
[IRC.git] / Robust / src / Util / Relation.java
1 package Util;
2 import java.util.*;
3
4
5 public class Relation {
6   private Hashtable table;
7   int size;
8
9   public Relation() {
10     table=new Hashtable();
11     size=0;
12   }
13
14   public int size() {
15     return size;
16   }
17
18   public boolean containsKey(Object o) {
19     return table.containsKey(o);
20   }
21
22   public Set keySet() {
23     return table.keySet();
24   }
25
26   public synchronized boolean put(Object key, Object value) {
27     HashSet s;
28     if (table.containsKey(key)) {
29       s=(HashSet) table.get(key);
30     } else {
31       s=new HashSet();
32       table.put(key,s);
33     }
34     if (!s.contains(value)) {
35       size++;
36       s.add(value);
37       return true;
38     } else
39       return false;
40   }
41
42   public Set get(Object key) {
43     return (Set)table.get(key);
44   }
45 }