Last change
on this file since 328 was 316, checked in by Tim Baarslag, 5 years ago |
new packages complete
|
File size:
572 bytes
|
Line | |
---|
1 | package bargainingchips;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import java.util.ArrayList;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * Can be used to build bundles easily.
|
---|
9 | */
|
---|
10 | public 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.