Line | |
---|
1 | package onetomany.bargainingchipsgame.players;
|
---|
2 |
|
---|
3 | import java.util.concurrent.BlockingQueue;
|
---|
4 |
|
---|
5 | import onetomany.bargainingchipsgame.Bundle;
|
---|
6 | import onetomany.bargainingchipsgame.interactions.Offer;
|
---|
7 |
|
---|
8 | public class BilateralAgent implements Runnable
|
---|
9 | {
|
---|
10 | BlockingQueue<Offer> in;
|
---|
11 | BlockingQueue<Offer> out;
|
---|
12 |
|
---|
13 | public BilateralAgent(BlockingQueue<Offer> in, BlockingQueue<Offer> out)
|
---|
14 | {
|
---|
15 | super();
|
---|
16 | this.in = in;
|
---|
17 | this.out = out;
|
---|
18 | }
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public void run()
|
---|
24 | {
|
---|
25 | while (true)
|
---|
26 | {
|
---|
27 | Offer o;
|
---|
28 | try {
|
---|
29 | o = in.take();
|
---|
30 | Bundle bundle = o.getBundle();
|
---|
31 | System.out.println("Received " + bundle);
|
---|
32 | } catch (InterruptedException e) {
|
---|
33 | // TODO Auto-generated catch block
|
---|
34 | e.printStackTrace();
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 | }
|
---|
39 |
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.