Line | |
---|
1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.util.ArrayList;
|
---|
4 | import java.util.HashMap;
|
---|
5 | import java.util.List;
|
---|
6 | import java.util.Set;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * @author Faria Nassiri-Mofakham
|
---|
10 | *
|
---|
11 | */
|
---|
12 | public class DemandPlan
|
---|
13 | {
|
---|
14 | private HashMap<Product, Integer> demandPlan;
|
---|
15 |
|
---|
16 |
|
---|
17 | public DemandPlan()
|
---|
18 | {
|
---|
19 | this.demandPlan = new HashMap<Product, Integer>();
|
---|
20 | }
|
---|
21 |
|
---|
22 | public HashMap<Product, Integer> getDemandPlan()
|
---|
23 | {
|
---|
24 | return demandPlan;
|
---|
25 | }
|
---|
26 |
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public String toString()
|
---|
30 | {
|
---|
31 | return demandPlan.toString();
|
---|
32 | }
|
---|
33 |
|
---|
34 | public void setQuantity(Product p, Integer n)
|
---|
35 | {
|
---|
36 | demandPlan.put(p,n);
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | public Integer getQuantity(Product p)
|
---|
41 | {
|
---|
42 | if (this.demandPlan.containsKey(p))
|
---|
43 | return demandPlan.get(p);
|
---|
44 | else
|
---|
45 | return 0;
|
---|
46 | }
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 | public Set<Product> getKeys()
|
---|
51 | {
|
---|
52 | return demandPlan.keySet();
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | public Set<Integer> getValues()
|
---|
57 | {
|
---|
58 | return (Set<Integer>) demandPlan.values();
|
---|
59 | }
|
---|
60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.