source: src/main/java/bargainingchips/wishlist/WishList.java@ 341

Last change on this file since 341 was 340, checked in by Tim Baarslag, 5 years ago

Change BilateralProtocol loop to avoid busy wait; note that this fixes only a part of the busy wait problem.

Package structure now in line with latest Acumex discussions.

Pinpointed error avoidance in Agent.

File size: 655 bytes
Line 
1package bargainingchips.wishlist;
2
3import java.util.Iterator;
4import java.util.Map;
5
6import bargainingchips.Chip;
7import bargainingchips.ChipMapping;
8
9/**
10 * A wish list is a list of chips with their quantities.
11 */
12public class WishList extends ChipMapping<Integer> implements Iterable<Chip>
13{
14 public WishList(Map<Chip, Integer> f)
15 {
16 this.f = f;
17 }
18
19 public int getQuantity(Chip c)
20 {
21 return f.get(c);
22 }
23
24 @Override
25 public Iterator<Chip> iterator()
26 {
27 return f.keySet().iterator();
28 }
29
30 @Override
31 public String toString()
32 {
33 return f.toString();
34 }
35
36 public int size()
37 {
38 return f.size();
39 }
40}
Note: See TracBrowser for help on using the repository browser.