changes
[IRC.git] / QueryQueue.java
1 public class QueryQueue {
2         HashSet queries;
3         int size;
4
5         public QueryQueue() {
6                 queries = new HashSet();
7                 size = 0;
8         }
9
10         public LocalQuery pop() {
11                 if (queries.isEmpty())
12                         return null;
13                 LocalQuery q = (LocalQuery) queries.iterator().next();
14                 queries.remove(q);
15                 size--;
16                 return q;
17         }
18
19         public void push(LocalQuery x) {
20                 queries.add(x);
21                 size++;
22         }
23         
24         public int size() {
25                 return size;
26         }
27
28         public boolean isEmpty() {
29                 if (size == 0)
30                         return true;
31                 else 
32                         return false;
33         }
34 }