"...gitlab@git.se.informatik.uni-kiel.de:she/theodolite.git" did not exist on "81226ad4a48283c3c7f21ccce4491f81a3cb60d7"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package teetime.examples.throughput.methodcall;
import teetime.util.concurrent.spsc.FFBufferOrdered3;
public class SpScPipe<T> implements IPipe<T> {
private final FFBufferOrdered3<T> queue = new FFBufferOrdered3<T>(4);
public static <T> void connect(final OutputPort<T> sourcePort, final InputPort<T> targetPort) {
IPipe<T> pipe = new SpScPipe<T>();
sourcePort.pipe = pipe;
targetPort.pipe = pipe;
}
@Override
public void add(final T element) {
this.queue.offer(element);
}
@Override
public T removeLast() {
return this.queue.poll();
}
@Override
public boolean isEmpty() {
return this.queue.isEmpty();
}
@Override
public int size() {
return this.queue.size();
}
@Override
public T readLast() {
return this.queue.peek();
}
}