0001-added-new-queue-adapter-for-strings.patch

C. Emmerich, 04/23/2013 12:10 PM

Download (1.39 KB)

View differences:

src/rsb/matlab/StringQueue.java
1
package rsb.matlab;
2

  
3
import java.util.concurrent.TimeUnit;
4

  
5
import rsb.util.QueueAdapter;
6

  
7
/**
8
 * Simple queuing callback adapting generic push-style RSBJava callback
9
 * interface to a simple, specialized and Matlab- compatible pull-style
10
 * interface.
11
 * 
12
 * @author cemmeric
13
 */
14
public class StringQueue extends QueueAdapter<String> {
15

  
16
	/**
17
	 * Delegate function to return queue objects as a list. It blocks until a
18
	 * result is available. Returned objects are removed from the underlying
19
	 * blocking queue.
20
	 * 
21
	 * @return string
22
	 * @throws InterruptedException
23
	 */
24
	public String take(int ms) throws InterruptedException {
25
		return getQueue().poll(ms, TimeUnit.MILLISECONDS);
26
	}
27

  
28
	public StringQueue(final int capacity, final boolean discardOldest) {
29
		super(capacity, discardOldest);
30
	}
31
	
32
}
0
-