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 |
|
---|
12 | public WishList(Map<Chip, Integer> f)
|
---|
13 | {
|
---|
14 | this.f = f;
|
---|
15 | }
|
---|
16 |
|
---|
17 | public int getQuantity(Chip c)
|
---|
18 | {
|
---|
19 | return f.get(c);
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public Iterator<Chip> iterator()
|
---|
24 | {
|
---|
25 | return f.keySet().iterator();
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public String toString()
|
---|
30 | {
|
---|
31 | return f.toString();
|
---|
32 | }
|
---|
33 |
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.