Coverage Summary for Class: Build (it.polimi.ingsw.view.model)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
Build | 100% (1/ 1) | 100% (4/ 4) | 100% (8/ 8) |
1 package it.polimi.ingsw.view.model;
2
3 import java.util.ArrayList;
4 import java.util.Arrays;
5 import java.util.List;
6 import java.util.stream.Collectors;
7
8 /**
9 * A Build Action Data Structure
10 */
11 public class Build implements RawObj {
12 /**
13 * Block that can be built
14 */
15 private final String block;
16 /**
17 * Position on the board
18 */
19 private final List<Integer> position;
20
21 /**
22 * Build Constructor
23 *
24 * @param block block to be built
25 * @param position position on the board
26 */
27 public Build(String block, List<Integer> position) {
28 this.block = block;
29 this.position = position;
30 }
31
32 @Override
33 public List<String> getRawData() {
34 return new ArrayList<>(Arrays.asList("Build", "Type Block: " + block,
35 "Position: [" + (position.get(0) * 5 + position.get(1)) + "]"));
36 }
37
38 /**
39 * Get Block to be built
40 *
41 * @return block type
42 */
43 public String getBlock() {
44 return block;
45 }
46
47 /**
48 * Get Position on the board
49 *
50 * @return board position
51 */
52 public List<Integer> getPosition() {
53 return position.stream().map(e -> e).collect(Collectors.toList());
54 }
55
56 }