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

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

Everything works with general Agents now

File size: 1.4 KB
Line 
1package onetomany.bargainingchipsgame.players;
2
3import java.util.concurrent.BlockingQueue;
4
5import onetomany.bargainingchipsgame.WishList;
6import onetomany.bargainingchipsgame.players.utilityfunction.UF_IWantColorAndQuantity;
7
8/**
9 * Coordinates all bilateral threads.
10 * The coordinator monitors and synchronizes all bilateral negotiation threads
11 * of each negotiator agent with an opponent regarding the whole preference list of the user.
12 */
13public class Coordinator implements Runnable
14{
15 // Messages coming in and out of the coordinator
16 protected BlockingQueue<NegotiationStatusMessage> cin;
17 protected BlockingQueue<CoordinationMessage> cout;
18 /** The fixed, initial wish list that should be obtained overall */
19 private WishList overallWishList;
20
21 public Coordinator(WishList wishlist, BlockingQueue<NegotiationStatusMessage> negotiationMsg,
22 BlockingQueue<CoordinationMessage> coordinationMsg)
23 {
24 this.overallWishList = wishlist;
25 cin = negotiationMsg;
26 cout = coordinationMsg;
27 }
28
29 @Override
30 public void run()
31 {
32 // Send a very simple coordination message to Bob_i after a while
33 try {
34 Thread.sleep(2000);
35
36 CoordinationMessage coordinationMessage2 = new CoordinationMessage();
37 coordinationMessage2.f = new UF_IWantColorAndQuantity("Green", 7);
38 cout.put(coordinationMessage2);
39
40 } catch (InterruptedException e) {
41 e.printStackTrace();
42 }
43
44 }
45
46}
Note: See TracBrowser for help on using the repository browser.