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