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