source: src/main/java/negotiator/onetomany/DemandPlan.java@ 228

Last change on this file since 228 was 226, checked in by Faria Nassiri Mofakham, 6 years ago

GUI updated (using Jpanel). DemandPlanDrawing updated. PutImaged renamed to DrawImage. DemandPlan is updating for the Utility, Bid, and Preference classes. Protocol and Agents packages (and some classes) added.

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