source: src/main/java/onetomany/bargainingchipsgame/players/Coordinator.java@ 279

Last change on this file since 279 was 279, checked in by Tim Baarslag, 5 years ago

Coordinator working

File size: 963 bytes
Line 
1package onetomany.bargainingchipsgame.players;
2
3import java.util.concurrent.BlockingQueue;
4
5import onetomany.bargainingchipsgame.players.utilityfunction.UF_IWant3Red;
6
7/**
8 * Coordinates all bilateral threads.
9 */
10public 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.