1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.List;
|
---|
5 | import java.util.Iterator;
|
---|
6 |
|
---|
7 | public class Main
|
---|
8 | {
|
---|
9 | private Portfolio portfolio;
|
---|
10 | private DemandPlan demandPlan;
|
---|
11 |
|
---|
12 | private int numType = 7; // this could later be gained from Domain
|
---|
13 |
|
---|
14 | public Main()
|
---|
15 | {
|
---|
16 | Product redProduct = new Product("Red");
|
---|
17 | Product pinkProduct = new Product("Pink");
|
---|
18 | Product blueProduct = new Product("Blue");
|
---|
19 | Product orangeProduct = new Product("Orange");
|
---|
20 |
|
---|
21 |
|
---|
22 | portfolio = new Portfolio();
|
---|
23 |
|
---|
24 | portfolio.addProduct(redProduct);
|
---|
25 | portfolio.addProduct(pinkProduct);
|
---|
26 | portfolio.addProduct(blueProduct);
|
---|
27 | portfolio.addProduct(orangeProduct);
|
---|
28 |
|
---|
29 |
|
---|
30 | demandPlan = new DemandPlan();
|
---|
31 | for (Product product : portfolio.getPortfolio())
|
---|
32 | demandPlan.setQuantity(product, (int)(Math.random()*numType+1));
|
---|
33 | // demandPlan.setQuantity(redProduct, 2);
|
---|
34 |
|
---|
35 | // System.out.println(demandPlan);
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | // Agent sam = new Sam();
|
---|
40 | // Agent sally = new Sally();
|
---|
41 | //
|
---|
42 | // Agent bob = new Bob();
|
---|
43 | //
|
---|
44 | // OneToManyProtocol p = new OneToManyProtocol(bob, sam, sally);
|
---|
45 | //===> BilateralThread(bob, sam) and BilateralThread(bob, sally)`
|
---|
46 | // p.start();
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 |
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | public Portfolio getPortfolio()
|
---|
55 | {
|
---|
56 | return portfolio;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public DemandPlan getDemandPlan()
|
---|
60 | {
|
---|
61 | return demandPlan;
|
---|
62 | }
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|