Coverage Summary for Class: Command (it.polimi.ingsw.utils.model)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
Command | 100% (1/ 1) | 100% (8/ 8) | 100% (19/ 19) |
1 package it.polimi.ingsw.utils.model;
2
3 /**
4 * Command Class used between to manage data between server and client
5 */
6 public class Command {
7 /**
8 * Info Type that this Command contains
9 *
10 * @see it.polimi.ingsw.utils.model.TypeCommand
11 */
12 private final String type;
13 /**
14 * Info
15 *
16 */
17 private final String info;
18 /**
19 * If this command can be used then this is not equals to null. This indicates
20 * the function to use.
21 */
22 private final String funcName;
23 /**
24 * Data used on Server Side to launch function
25 */
26 private final String funcData;
27 /**
28 * Status used to decide if add or remove this information on Client Side. True
29 * => add, False => Remove
30 */
31 private Boolean status;
32
33 /**
34 * Simple Command Constructor
35 *
36 * @param type command type
37 * @param info command info
38 */
39 public Command(String type, String info) {
40 this.type = type;
41 this.info = info;
42 this.funcName = null;
43 this.funcData = null;
44 }
45
46 /**
47 * Usable Command Constructor
48 *
49 * @param type command type
50 * @param funcName command function to launch
51 * @param info command info
52 * @param funcData command data to use in the function
53 */
54 public Command(String type, String funcName, String info, String funcData) {
55 this.type = type;
56 this.funcName = funcName;
57 this.info = info;
58 this.funcData = funcData;
59 }
60
61 /**
62 * Set Command status
63 *
64 * @param status command status
65 */
66 public void setStatus(Boolean status) {
67 this.status = status;
68 }
69
70 /**
71 * Get Command status
72 *
73 */
74 public Boolean getStatus() {
75 return status;
76 }
77
78 /**
79 * Get Command type
80 *
81 */
82 public String getType() {
83 return type;
84 }
85
86 /**
87 * Get Command info
88 *
89 */
90 public String getInfo() {
91 return info;
92 }
93
94 /**
95 * Get Command data to use with the function on server
96 *
97 */
98 public String getFuncData() {
99 return funcData;
100 }
101
102 /**
103 * Get Command function to launch on server
104 *
105 */
106 public String getFuncName() {
107 return funcName;
108 }
109 }