-
Notifications
You must be signed in to change notification settings - Fork 58
/
flag.java
57 lines (50 loc) · 1.46 KB
/
flag.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
/**
* Flag is a record flagging a potential cheating incident
*
* Version 2.0.1 - 5/31/20 cleanup - added Flag class, catch null pointers
* Version 2.0.2 - 6/5/20 print cleanup - added equals for red flag searches
*
*/
public class Flag {
// No username as it will be held by a particular user
private Problem problem; // problem where cheating occurred (e.g. Ex 12:18)
private String reason; // description of type of cheating (e.g. "Tries")
/**
* Construct cheating Flag from the problem and reason
*
* @param problem
* @param reason
*/
public Flag(Problem problem, String reason) {
super();
this.problem = problem;
this.reason = reason;
}
public Problem getProblem() {
return this.problem;
}
public void setProblem(Problem problem) {
this.problem = problem;
}
public String getReason() {
return this.reason;
}
public void setReason(String reason) {
this.reason = reason;
}
@Override
public String toString() {
return this.problem + this.reason;
}
@Override
/**
* Flag.equals compares the reason only
* This is used to check if a "red flag" has already been filed so problem is not desired
*/
public boolean equals(Object o) {
if (o == this)
return true;
Flag f = (Flag)o;
return (f.getReason() == this.getReason());
}
}