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
|
Line | |
---|
1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.List;
|
---|
5 | import java.util.Iterator;
|
---|
6 |
|
---|
7 | public class Main
|
---|
8 | {
|
---|
9 | private Portfolio portfolio;
|
---|
10 | private DemandPlan demandPlan;
|
---|
11 |
|
---|
12 | public Main()
|
---|
13 | {
|
---|
14 | Product redProduct = new Product("Red");
|
---|
15 | Product pinkProduct = new Product("Pink");
|
---|
16 | Product blueProduct = new Product("Blue");
|
---|
17 |
|
---|
18 |
|
---|
19 | portfolio = new Portfolio();
|
---|
20 |
|
---|
21 | portfolio.addProduct(redProduct);
|
---|
22 | portfolio.addProduct(pinkProduct);
|
---|
23 | portfolio.addProduct(pinkProduct);
|
---|
24 | portfolio.addProduct(pinkProduct);
|
---|
25 | portfolio.addProduct(blueProduct);
|
---|
26 |
|
---|
27 |
|
---|
28 | // int s = portfolio.size();
|
---|
29 | // for (int i=0; i<s; i++)
|
---|
30 | // {
|
---|
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 |
|
---|
41 | demandPlan = new DemandPlan();
|
---|
42 |
|
---|
43 | for (Product product : portfolio.getPortfolio())
|
---|
44 | {
|
---|
45 | demandPlan.setQuantity(product, (int)(Math.random()*5+1));
|
---|
46 | }
|
---|
47 |
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | public Portfolio getPortfolio()
|
---|
52 | {
|
---|
53 | return portfolio;
|
---|
54 | }
|
---|
55 |
|
---|
56 | public DemandPlan getDemandPlan()
|
---|
57 | {
|
---|
58 | return demandPlan;
|
---|
59 | }
|
---|
60 |
|
---|
61 | }
|
---|
62 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.