1 |
package java.util.concurrent; |
2 |
|
3 |
import java.util.*; |
4 |
|
5 |
/** |
6 |
* An unbounded queue in which elements cannot be taken until |
7 |
* their indicated delays have elapsed. |
8 |
**/ |
9 |
|
10 |
public class DelayQueue<E> extends AbstractCollection<E> |
11 |
implements BlockingQueue<E>, java.io.Serializable { |
12 |
|
13 |
public DelayQueue() {} |
14 |
|
15 |
/** |
16 |
* Add the given element to the queue, to be taken after the given delay. |
17 |
* @param unit the time to delay |
18 |
* @param unit the granularity of the time unit |
19 |
* @param x the element |
20 |
*/ |
21 |
public boolean add(long delay, TimeUnit granularity, E x) { |
22 |
return false; |
23 |
} |
24 |
|
25 |
/** |
26 |
* Return the time until the given element may be taken, |
27 |
* in the requested time granularity. |
28 |
* @param element the element |
29 |
* @param granularity the time granularity |
30 |
* @throws NoSuchElementException if element not present |
31 |
*/ |
32 |
public long getDelay(E element, TimeUnit granularity) { |
33 |
return 0; |
34 |
} |
35 |
|
36 |
/** |
37 |
* Return the time until the earliest element may be taken, |
38 |
* in the requested time granularity. |
39 |
* @param granularity the time granularity |
40 |
* @throws NoSuchElementException if empty |
41 |
*/ |
42 |
public long getEarliestDelay(TimeUnit granularity) { |
43 |
return 0; |
44 |
} |
45 |
|
46 |
|
47 |
/** |
48 |
* Equivalent to add(0, [any time unit], x). |
49 |
**/ |
50 |
public void put(E x) { |
51 |
} |
52 |
/** |
53 |
* Equivalent to add(0, [any time unit], x). |
54 |
**/ |
55 |
public boolean offer(E x, long time, TimeUnit granularity) { |
56 |
return false; |
57 |
} |
58 |
/** |
59 |
* Equivalent to add(0, [any time unit], x). |
60 |
**/ |
61 |
public boolean add(E x) { |
62 |
return false; |
63 |
} |
64 |
/** |
65 |
* Equivalent to add(0, [any time unit], x). |
66 |
**/ |
67 |
public boolean offer(E x) { |
68 |
return false; |
69 |
} |
70 |
|
71 |
|
72 |
public E take() throws InterruptedException { |
73 |
return null; |
74 |
} |
75 |
public E remove() { |
76 |
return null; |
77 |
} |
78 |
public Iterator<E> iterator() { |
79 |
return null; |
80 |
} |
81 |
|
82 |
public boolean remove(Object x) { |
83 |
return false; |
84 |
} |
85 |
public E element() { |
86 |
return null; |
87 |
} |
88 |
public E poll() { |
89 |
return null; |
90 |
} |
91 |
public E poll(long time, TimeUnit granularity) throws InterruptedException { |
92 |
return null; |
93 |
} |
94 |
public E peek() { |
95 |
return null; |
96 |
} |
97 |
public boolean isEmpty() { |
98 |
return false; |
99 |
} |
100 |
public int size() { |
101 |
return 0; |
102 |
} |
103 |
public Object[] toArray() { |
104 |
return null; |
105 |
} |
106 |
|
107 |
public <T> T[] toArray(T[] array) { |
108 |
return null; |
109 |
} |
110 |
} |