source: src/main/java/negotiator/onetomany/Bid.java@ 226

Last change on this file since 226 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: 968 bytes
Line 
1package negotiator.onetomany;
2
3import java.util.HashMap;
4import java.util.Set;
5
6
7/**
8 * * A demand plan is a specification of the demand of an agent for each product.
9 * An example:
10 * Red -> 4, Blue -> 4, Yellow -> 2
11 *
12 *
13 *
14 *
15 *
16 * @author Faria Nassiri-Mofakham
17 *
18 */
19public class Bid extends DemandPlan
20{
21
22 private HashMap<Product, Integer> bid;
23
24
25 public Bid()
26 {
27 this.bid = new HashMap<Product, Integer>();
28 }
29
30 public HashMap<Product, Integer> getBid()
31 {
32 return bid;
33 }
34
35
36 @Override
37 public String toString()
38 {
39 return bid.toString();
40 }
41
42 public void setQuantity(Product p, Integer n)
43 {
44 bid.put(p,n);
45 }
46
47 public Integer getQuantity(Product p)
48 {
49 if (this.bid.containsKey(p))
50 return bid.get(p);
51 else
52 return 0;
53 }
54
55
56
57 public Set<Product> getKeys()
58 {
59 return bid.keySet();
60 }
61
62
63 public Set<Integer> getValues()
64 {
65 return (Set<Integer>) bid.values();
66 }
67
68
69}
Note: See TracBrowser for help on using the repository browser.