Rev | Line | |
---|
[316] | 1 | package bargainingchips.etc;
|
---|
[315] | 2 |
|
---|
| 3 | import java.util.HashMap;
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | *
|
---|
| 7 | *
|
---|
| 8 | *
|
---|
| 9 | *
|
---|
| 10 | *
|
---|
| 11 | * @author Faria Nassiri-Mofakham
|
---|
| 12 | *
|
---|
| 13 | */
|
---|
| 14 | public class DemandPlan
|
---|
| 15 | {
|
---|
| 16 | private HashMap<Product, Integer> demandPlan;
|
---|
| 17 | private HashMap<Product, Double> weight;
|
---|
| 18 |
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | public DemandPlan()
|
---|
| 22 | {
|
---|
| 23 | this.demandPlan = new HashMap<Product, Integer>();
|
---|
| 24 | this.weight = new HashMap<Product, Double>();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | public HashMap<Product, Integer> getDemandPlan()
|
---|
| 28 | {
|
---|
| 29 | return demandPlan;
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public HashMap<Product, Double> getWeight()
|
---|
| 33 | {
|
---|
| 34 | return weight;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | @Override
|
---|
| 39 | public String toString()
|
---|
| 40 | {
|
---|
| 41 | return demandPlan.toString();
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | public void setQuantity(Product p, Integer n)
|
---|
| 45 | {
|
---|
| 46 | demandPlan.put(p,n);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | public void setWeight(Product p, Double e)
|
---|
| 51 | {
|
---|
| 52 | weight.put(p,e);
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | public Integer getQuantity(Product p)
|
---|
| 56 | {
|
---|
| 57 | if (this.demandPlan.containsKey(p))
|
---|
| 58 | return demandPlan.get(p);
|
---|
| 59 | else
|
---|
| 60 | return 0;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | public Double getWeight(Product p)
|
---|
| 64 | {
|
---|
| 65 | if (this.weight.containsKey(p))
|
---|
| 66 | return weight.get(p);
|
---|
| 67 | else
|
---|
| 68 | return 0.0;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | // public Set<Product> getKeys()
|
---|
| 72 | // {
|
---|
| 73 | // return demandPlan.keySet();
|
---|
| 74 | // }
|
---|
| 75 | //
|
---|
| 76 | //
|
---|
| 77 | // public Set<Integer> getValues()
|
---|
| 78 | // {
|
---|
| 79 | // return (Set<Integer>) demandPlan.values();
|
---|
| 80 | // }
|
---|
| 81 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.