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