-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlPanel.java
More file actions
207 lines (177 loc) · 3.71 KB
/
ControlPanel.java
File metadata and controls
207 lines (177 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import java.util.ArrayList;
import java.util.Arrays;
public class ControlPanel {
private String usersString; // all users in a string
private ArrayList<String> users; // array of the users
private String selectedUser = null; // the selected user
private String answer; // the answer of the opponent
private boolean no; // check for answer no
private boolean usersSend = false; // check if the user is send
private String nickname; // the nickname of the user
private boolean scoreboard = false; // check if the scoreboard is enquired
private String scoreboardUsers; // user and result in a string
private ArrayList<String> scoreboardArray; // array of users and results
/**
* initialize the arrays
*/
public ControlPanel(){
users = new ArrayList<String>();
scoreboardArray = new ArrayList<String>();
}
/*
* get the strings of users
*/
public String getUsersString() {
return usersString;
}
/*
* set the string of users
*/
public void setUsersString(String usersString) {
this.usersString = usersString;
}
/*
* get the array of users
*/
public ArrayList<String> getUsers() {
return users;
}
/*
* get the count of the users
*/
public int getUsersCount(){
return users.size();
}
/*
* set the users to an array
*/
public void setUsers() {
if(usersString != null && usersString != ""){
users = new ArrayList<String>(Arrays.asList(usersString.split(",")));
}
}
/*
* get a particular user
*/
public String getUser(int i){
String user = null;
if(!users.isEmpty()){
user = users.get(i);
}
return user;
}
/*
* get the selected user
*/
public String getSelectedUser() {
return selectedUser;
}
/*
* set the selected user
*/
public void setSelectedUser(String selectedUser) {
this.selectedUser = selectedUser;
}
/*
* get the answer
*/
public String getAnswer() {
return answer;
}
/*
* set the answer
*/
public void setAnswer(String answer) {
this.answer = answer;
}
/*
* if no answer
*/
public boolean getAnswerNo(){
return this.no;
}
/*
* set if no answer
*/
public void setAnswerNo(boolean no){
this.no = no;
}
/*
* chekck if user send
*/
public boolean isUsersSend() {
return usersSend;
}
/*
* set if user send
*/
public void setUsersSend(boolean usersSend) {
this.usersSend = usersSend;
}
/*
* get the nickname
*/
public String getNickname() {
return nickname;
}
/*
* set the nickname
*/
public void setNickname(String nickname) {
this.nickname = nickname;
}
/*
* check if scoreboard is enquired
*/
public boolean isScoreboard() {
return scoreboard;
}
/*
* set if scoreboard is enquired
*/
public void setScoreboard(boolean scoreboard) {
this.scoreboard = scoreboard;
}
/*
* get string of the users and the results in the scoreboard
*/
public String getScoreboardUsers() {
return scoreboardUsers;
}
/*
* set string of the users and the results in the scoreboard
*/
public void setScoreboardUsers(String scoreboardUsers) {
this.scoreboardUsers = scoreboardUsers;
}
/*
* get an array of the scoreboards data
*/
public ArrayList<String> getScoreboardArray() {
return scoreboardArray;
}
/*
* set the string of scoreboard data into array
*/
public void setScoreboardArray() {
if(scoreboardUsers != null && scoreboardUsers != ""){
scoreboardArray = new ArrayList<String>(Arrays.asList(scoreboardUsers.split(";")));
}
}
/*
* get the array of scoreboard size
*/
public int getScoreboardArraySize(){
return scoreboardArray.size();
}
/*
* get a particular user
*/
public String getScoreboardUser(int i){
String user = null;
if(!scoreboardArray.isEmpty()){
user = scoreboardArray.get(i);
}
return user;
}
}