[ all classes ]
[ it.polimi.ingsw.model ]
Coverage Summary for Class: Block (it.polimi.ingsw.model)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
Block | 100% (1/ 1) | 100% (6/ 6) | 100% (14/ 14) |
1 package it.polimi.ingsw.model;
2
3 /**
4 * Class that is used to store a game board block information
5 */
6 public class Block implements Cloneable {
7 /**
8 * Block Type
9 */
10 final private TypeBlock typeBlock;
11 /**
12 * Block Owner, Default null
13 */
14 final private String owner;
15 /**
16 * Block Color, Default null
17 *
18 * @see it.polimi.ingsw.model.Color
19 */
20 final private Color color;
21
22 /**
23 * Create a Block instance of a specific typeBlock
24 *
25 * @param typeBlock type to set
26 */
27 public Block(TypeBlock typeBlock) {
28 this.typeBlock = typeBlock;
29 this.owner = null;
30 this.color = null;
31 }
32
33 /**
34 * Create a Block instance of a specific typeBlock, owner and color
35 *
36 * @param typeBlock type to set
37 * @param owner owner to set
38 * @param color color to set
39 */
40 public Block(TypeBlock typeBlock, String owner, Color color) {
41 this.typeBlock = typeBlock;
42 this.owner = owner;
43 this.color = color;
44 }
45
46 /**
47 * Get the block type
48 *
49 * @return block type
50 */
51 public TypeBlock getTypeBlock() {
52 return typeBlock;
53 }
54
55 @Override
56 public Block clone() {
57 return new Block(typeBlock, owner, color);
58 }
59
60 /**
61 * Get the block owner
62 *
63 * @return block owner
64 */
65 public String getOwner() {
66 return owner;
67 }
68
69 /**
70 * Get the block color
71 *
72 * @return block color
73 */
74 public Color getColor() {
75 return color;
76 }
77 }