Rev | Line | |
---|
[210] | 1 | package negotiator.onetomany;
|
---|
| 2 |
|
---|
| 3 | import java.util.ArrayList;
|
---|
[215] | 4 | import java.util.HashMap;
|
---|
[210] | 5 | import java.util.List;
|
---|
[219] | 6 | import java.util.Set;
|
---|
[210] | 7 |
|
---|
| 8 | /**
|
---|
| 9 | * @author Faria Nassiri-Mofakham
|
---|
| 10 | *
|
---|
| 11 | */
|
---|
| 12 | public class DemandPlan
|
---|
| 13 | {
|
---|
[215] | 14 | private HashMap<Product, Integer> demandPlan;
|
---|
[210] | 15 |
|
---|
[215] | 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 | }
|
---|
[224] | 33 |
|
---|
[219] | 34 | public void setQuantity(Product p, Integer n)
|
---|
| 35 | {
|
---|
| 36 | demandPlan.put(p,n);
|
---|
| 37 | }
|
---|
[224] | 38 |
|
---|
| 39 |
|
---|
[219] | 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 |
|
---|
[224] | 48 |
|
---|
| 49 |
|
---|
[219] | 50 | public Set<Product> getKeys()
|
---|
| 51 | {
|
---|
| 52 | return demandPlan.keySet();
|
---|
| 53 | }
|
---|
[224] | 54 |
|
---|
| 55 |
|
---|
[219] | 56 | public Set<Integer> getValues()
|
---|
| 57 | {
|
---|
| 58 | return (Set<Integer>) demandPlan.values();
|
---|
| 59 | }
|
---|
[210] | 60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.