source: src/main/java/negotiator/onetomany/Portfolio.java@ 211

Last change on this file since 211 was 211, checked in by Faria Nassiri Mofakham, 5 years ago

For keeping track (Shapes added, several changes to Product, Portfolio, Main, and GUI classes; contains some errors) to return back after some more changes.

File size: 768 bytes
Line 
1package negotiator.onetomany;
2
3import java.util.List;
4//import java.awt.Color;
5import java.util.ArrayList;
6
7/**
8 * A portfolio is a list of products that is relevant to an agent
9 */
10public class Portfolio
11{
12 private List<Product> portfolio;
13
14 public Portfolio()
15 {
16 this.portfolio = new ArrayList<Product>();
17 }
18
19 public List<Product> getPortfolio()
20 {
21 return portfolio;
22 }
23
24 public void addProduct(Product p)
25 {
26 portfolio.add(p);
27 }
28
29 @Override
30 public String toString()
31 {
32 return portfolio.toString();
33 }
34
35
36
37
38 public int size()
39 {
40 if (portfolio != null)
41 {
42 return getPortfolio().size();
43 }
44 else return 0;
45
46 }
47
48 public Product getProduct(int i)
49 {
50 return getPortfolio().get(i);
51 }
52}
Note: See TracBrowser for help on using the repository browser.