source: src/main/java/onetomany/bargainingchipsgame/BundleBuilder.java@ 272

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

Bundle immutable. Made aggregation work.

File size: 613 bytes
RevLine 
[272]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 BundleBuilder
14{
15 private List<Stack> bundle;
16
17 /**
18 * Makes sure bundle remains unmodifiable.
19 */
20 public BundleBuilder()
21 {
22 this.bundle = new ArrayList<Stack>();
23 }
24
25 public BundleBuilder addStack(String c, double p, int q)
26 {
27 bundle.add(new Stack(c, p, q));
28 return this;
29 }
30
31 /**
32 * @return Immutable bundle
33 */
34 public Bundle build()
35 {
36 return new Bundle(bundle);
37 }
38
39}
Note: See TracBrowser for help on using the repository browser.