source: src/main/java/negotiator/onetomany/Main.java@ 222

Last change on this file since 222 was 222, checked in by Faria Nassiri Mofakham, 6 years ago
  • GUI is multicolumn (backgrounds and distances also updated; distances still need to be more dynamically )
  • Drawing temporarily moved into Drawing1 and Drawing2 for painting Portfolio and DemandPlan, respectively (Next, both may be combined or inherit a single Drawing)
File size: 1.3 KB
RevLine 
[209]1package negotiator.onetomany;
2
[211]3import java.awt.Color;
[219]4import java.awt.List;
5import java.util.Iterator;
[211]6
[209]7public class Main
8{
9 private Portfolio portfolio;
[215]10 private DemandPlan demandPlan;
[209]11
12 public Main()
13 {
[212]14 Product redProduct = new Product("Red");
15 Product pinkProduct = new Product("Pink");
16 Product blueProduct = new Product("Blue");
[211]17
[215]18
[209]19 portfolio = new Portfolio();
[215]20
[209]21 portfolio.addProduct(redProduct);
[212]22 portfolio.addProduct(pinkProduct);
[219]23 portfolio.addProduct(pinkProduct);
[222]24 portfolio.addProduct(pinkProduct);
[209]25 portfolio.addProduct(blueProduct);
[215]26
[219]27
[215]28// int s = portfolio.size();
29// for (int i=0; i<s; i++)
30// {
[219]31// //demandPlan.setQuantity(portfolio.getProduct(i), (int)Math.random()*5+1 );
32//// System.out.println(portfolio.getProduct(i).getColor());
33// }
34//
35//// Iterator<Product> t = (Iterator<Product>) portfolio.iterator();
36//// for(List p:t)
37//// {
38//// System.out.println(p);
39//// }
40
[222]41 demandPlan = new DemandPlan();
42
43 for (Product product : portfolio.getPortfolio())
44 {
45 demandPlan.setQuantity(product, (int)(Math.random()*5+1));
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
Note: See TracBrowser for help on using the repository browser.