source: src/main/java/bargainingchips/players/Coordinator.java@ 337

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

New Buyer class with a Coordinator and List<NegotiationThread>.

NegotiationThreads make it possible to connnect with multiple sellers

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