Line | |
---|
1 | package onetomany.bargainingchipsgame.players;
|
---|
2 |
|
---|
3 | import java.util.concurrent.BlockingQueue;
|
---|
4 |
|
---|
5 | import onetomany.bargainingchipsgame.players.utilityfunction.UF_IWant3Red;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Coordinates all bilateral threads.
|
---|
9 | */
|
---|
10 | public class Coordinator implements Runnable
|
---|
11 | {
|
---|
12 | // Messaging comin gin and out of the coordinator
|
---|
13 | protected BlockingQueue<NegotiationStatusMessage> cin;
|
---|
14 | protected BlockingQueue<CoordinationMessage> cout;
|
---|
15 |
|
---|
16 | public Coordinator(BlockingQueue<NegotiationStatusMessage> negotiationMsg,
|
---|
17 | BlockingQueue<CoordinationMessage> coordinationMsg)
|
---|
18 | {
|
---|
19 | cin = negotiationMsg;
|
---|
20 | cout = coordinationMsg;
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Override
|
---|
24 | public void run()
|
---|
25 | {
|
---|
26 | // Send a very simple coordination message to Bob
|
---|
27 | CoordinationMessage coordinationMessage = new CoordinationMessage();
|
---|
28 | coordinationMessage.f = new UF_IWant3Red();
|
---|
29 | try {
|
---|
30 | cout.put(coordinationMessage);
|
---|
31 | } catch (InterruptedException e) {
|
---|
32 | e.printStackTrace();
|
---|
33 | }
|
---|
34 | }
|
---|
35 |
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.