Last change
on this file since 262 was 257, checked in by Faria Nassiri Mofakham, 5 years ago |
1) BilateralNegotiation which extends Thread added to onetomany. According to BCG protocol this creates two threads, one for a buyer and one for a seller (it now generates null agents). 2) An ActionListener added to close button in onetomany.etc.GUI.
|
File size:
1.2 KB
|
Rev | Line | |
---|
[253] | 1 | package onetomany.etc;
|
---|
[257] | 2 |
|
---|
| 3 | public class Main
|
---|
| 4 | {
|
---|
| 5 | private Portfolio portfolio;
|
---|
| 6 | private DemandPlan demandPlan;
|
---|
| 7 |
|
---|
| 8 | public static int numType = 7; // this could later be gained from Domain
|
---|
| 9 |
|
---|
| 10 | public Main()
|
---|
| 11 | {
|
---|
| 12 | Product redProduct = new Product("Red");
|
---|
| 13 | Product pinkProduct = new Product("Pink");
|
---|
| 14 | Product blueProduct = new Product("Blue");
|
---|
| 15 | //Product orangeProduct = new Product("Orange");
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | portfolio = new Portfolio();
|
---|
| 19 |
|
---|
| 20 | portfolio.addProduct(redProduct);
|
---|
| 21 | portfolio.addProduct(pinkProduct);
|
---|
| 22 | portfolio.addProduct(blueProduct);
|
---|
| 23 | //portfolio.addProduct(orangeProduct);
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | demandPlan = new DemandPlan();
|
---|
| 27 | // for (Product product : portfolio.getPortfolio())
|
---|
| 28 | // demandPlan.setQuantity(product, (int)(Math.random()*numType+1));
|
---|
| 29 |
|
---|
| 30 | // System.out.println(demandPlan);
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | // Agent sam = new Sam();
|
---|
| 35 | // Agent sally = new Sally();
|
---|
[225] | 36 | //
|
---|
[257] | 37 | // Agent bob = new Bob();
|
---|
[225] | 38 | //
|
---|
[257] | 39 | // OneToManyProtocol p = new OneToManyProtocol(bob, sam, sally);
|
---|
| 40 | //===> BilateralThread(bob, sam) and BilateralThread(bob, sally)`
|
---|
| 41 | // p.start();
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | public Portfolio getPortfolio()
|
---|
| 50 | {
|
---|
| 51 | return portfolio;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public DemandPlan getDemandPlan()
|
---|
| 55 | {
|
---|
| 56 | return demandPlan;
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | }
|
---|
| 60 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.