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

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

WishList v1

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