-
Notifications
You must be signed in to change notification settings - Fork 0
/
Question.java
67 lines (54 loc) · 1.42 KB
/
Question.java
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
package projects.askfm;
import java.io.Serializable;
public class Question implements Serializable {
private static final long serialVersionUID = 1L;
private final int ID;
private final int ID_FROM;
private final int ID_TO;
private final boolean ANONYMOUSE_Q;
private final int PARENT_ID;
private final String TEXT;
private String Answer;
public Question(int iD_FROM, int iD_TO, String tEXT, boolean aNONYMOUSE_Q, int parentID) {
ID = (int) Math.floor(Math.random() * (50 - 1 + 1) + 1); // 1 <= id <= 50
ID_FROM = iD_FROM;
ID_TO = iD_TO;
TEXT = tEXT;
Answer = "";
ANONYMOUSE_Q = aNONYMOUSE_Q;
PARENT_ID = parentID;
}
public int getId() {
return ID;
}
public String getAnswer() {
return this.Answer;
}
public int getID_FROM() {
return ID_FROM;
}
public int getID_TO() {
return ID_TO;
}
public int getParentID() {
return this.PARENT_ID;
}
public void setAnswer(String Answer) {
this.Answer = Answer;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder("");
if (PARENT_ID != -1) {
s.append("\t Thread: ");
}
if (ANONYMOUSE_Q) {
s.append("Question [ID: " + ID + ", ID_From: Anonymouse" + ", ID_TO: " + ID_TO + ", TEXT: " + TEXT
+ ", Answer: " + Answer + "]");
return s.toString();
}
s.append("Question [ID: " + ID + ", ID_FROM: " + ID_FROM + ", ID_TO: " + ID_TO + ", TEXT: " + TEXT
+ ", Answer: " + Answer + "]");
return s.toString();
}
}