source: src/main/java/onetomany/BilateralNegotiation.java@ 266

Last change on this file since 266 was 263, checked in by Faria Nassiri Mofakham, 5 years ago

Offer class updated; Message enum created; parapoloid tried in GUI; some small changes in some previous classes (Bundle, stack,.. ); UF_Silly renamed to UF_Crazy; started to add role to UF classes...

File size: 1.8 KB
RevLine 
[257]1/**
2 *
3 */
4package onetomany;
5
6
7import onetomany.bargainingchipsgame.Bundle;
8import onetomany.bargainingchipsgame.Chip;
9import onetomany.bargainingchipsgame.Stack;
10import onetomany.bargainingchipsgame.players.Agent;
11import onetomany.bargainingchipsgame.players.utilityfunction.UF_75pQtyOrNothing;
12import onetomany.bargainingchipsgame.players.utilityfunction.UF_FreeDisposal;
13
14/**
15 * @author Faria Nassiri-Mofakham
16 *
17 */
18public class BilateralNegotiation extends Thread{
19
[258]20// private long number;
[257]21 private Agent buyer;
22 private Agent seller;
23
24
[263]25 public BilateralNegotiation(int i)
[257]26 {
27 super();
28 }
29
30 public void run() {
31 // TODO Auto-generated method stub
32
33 Bundle a=new Bundle();
34 a.addStack(new Stack(new Chip("Blue", 4), 30));
35 a.addStack(new Stack(new Chip("Orange", 6), 20));
36
37 Runnable buyer = (Runnable) new Agent("Bob",a, new UF_75pQtyOrNothing(a), 10, null);
38 new Thread(buyer).start();
[258]39// System.out.println(buyer);
[257]40
41
42 Bundle b=new Bundle();
43 b.addStack(new Stack(new Chip("Red", 2), 50));
44 b.addStack(new Stack(new Chip("Green", 5), 70));
45
46 Runnable seller = (Runnable) new Agent("Sally",b, new UF_FreeDisposal(b), 20, null);
47 new Thread(seller).start();
[258]48// System.out.println(seller);
[257]49
[258]50 buyer.run();
51 seller.run();
52
53 super.run();
[257]54
55 }
56
57 @Override
58 public String toString()
59 {
[258]60 //return this.getClass().getSimpleName()+"("+number+")\n"+buyer+"\n"+seller+"\n";
61 return this.getClass().getSimpleName()+"\n"+buyer+"\n"+seller+"\n";
62
[257]63 }
64 /**
65 * @param args
66 */
67 public static void main(String[] args)
68 {
69 // TODO Auto-generated method stub
70
[258]71
[263]72 for (int i=0; i<5; i++)
[257]73 {
[263]74 BilateralNegotiation t=new BilateralNegotiation(i);
[258]75 t.start();
[257]76 System.out.println(t);
77 }
78 }
79
80}
Note: See TracBrowser for help on using the repository browser.