[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");
|
---|
[226] | 19 | Product orangeProduct = new Product("Orange");
|
---|
[211] | 20 |
|
---|
[215] | 21 |
|
---|
[209] | 22 | portfolio = new Portfolio();
|
---|
[215] | 23 |
|
---|
[209] | 24 | portfolio.addProduct(redProduct);
|
---|
[212] | 25 | portfolio.addProduct(pinkProduct);
|
---|
[209] | 26 | portfolio.addProduct(blueProduct);
|
---|
[226] | 27 | portfolio.addProduct(orangeProduct);
|
---|
[215] | 28 |
|
---|
[226] | 29 |
|
---|
[222] | 30 | demandPlan = new DemandPlan();
|
---|
[224] | 31 | for (Product product : portfolio.getPortfolio())
|
---|
| 32 | demandPlan.setQuantity(product, (int)(Math.random()*numType+1));
|
---|
| 33 | // demandPlan.setQuantity(redProduct, 2);
|
---|
[222] | 34 |
|
---|
[224] | 35 | // System.out.println(demandPlan);
|
---|
[225] | 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 |
|
---|
[219] | 50 |
|
---|
[209] | 51 | }
|
---|
[219] | 52 |
|
---|
[209] | 53 |
|
---|
| 54 | public Portfolio getPortfolio()
|
---|
| 55 | {
|
---|
| 56 | return portfolio;
|
---|
| 57 | }
|
---|
[215] | 58 |
|
---|
[219] | 59 | public DemandPlan getDemandPlan()
|
---|
| 60 | {
|
---|
| 61 | return demandPlan;
|
---|
| 62 | }
|
---|
[209] | 63 |
|
---|
| 64 | }
|
---|
[215] | 65 |
|
---|