source: src/main/java/bargainingchips/BundleBuilder.java@ 318

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

new packages complete

File size: 572 bytes
Line 
1package bargainingchips;
2
3import java.util.List;
4
5import java.util.ArrayList;
6
7/**
8 * Can be used to build bundles easily.
9 */
10public class BundleBuilder
11{
12 private List<Stack> bundle;
13
14 /**
15 * Makes sure bundle remains unmodifiable.
16 */
17 public BundleBuilder()
18 {
19 this.bundle = new ArrayList<Stack>();
20 }
21
22 public BundleBuilder addStack(String c, double p, int q)
23 {
24 bundle.add(new Stack(c, p, q));
25 return this;
26 }
27
28 /**
29 * @return Immutable bundle
30 */
31 public Bundle build()
32 {
33 return new Bundle(bundle);
34 }
35
36}
Note: See TracBrowser for help on using the repository browser.