source: src/main/java/onetomany/bargainingchipsgame/WishListBuilder.java@ 281

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

WishList created

File size: 650 bytes
Line 
1/**
2 * Bundle class
3 */
4package onetomany.bargainingchipsgame;
5
6import java.util.HashMap;
7import java.util.Map;
8
9/**
10 * Can be used to build bundles easily.
11 */
12public class WishListBuilder
13{
14 private Map<Chip, Integer> f;
15
16 /**
17 * Makes sure bundle remains unmodifiable.
18 */
19 public WishListBuilder()
20 {
21 f = new HashMap<Chip, Integer>();
22 }
23
24 /**
25 * Add a wish to the wish list, such as 3 x Green
26 */
27 public WishListBuilder addWish(String c, int q)
28 {
29 f.put(new Chip(c), q);
30 return this;
31 }
32
33 /**
34 * @return Immutable bundle
35 */
36 public WishList build()
37 {
38 return new WishList(f);
39 }
40
41}
Note: See TracBrowser for help on using the repository browser.