source: src/main/java/onetomany/etc/DemandPlan.java@ 257

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

1) BilateralNegotiation which extends Thread added to onetomany. According to BCG protocol this creates two threads, one for a buyer and one for a seller (it now generates null agents). 2) An ActionListener added to close button in onetomany.etc.GUI.

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