ForcesQueue.java

Anonymous, 09/17/2014 01:21 PM

Download (867 Bytes)

 
1
package rsb.matlab;
2

    
3
import java.util.concurrent.TimeUnit;
4

    
5
import rsb.util.QueueAdapter;
6
import rst.dynamics.ForcesType.Forces;
7

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

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

    
29
        public ForcesQueue(final int capacity, final boolean discardOldest) {
30
                super(capacity, discardOldest);
31
        }
32

    
33
}