forked from CS2113-AY1819S1-F10-3/main
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatrolResource.java
80 lines (64 loc) · 2.01 KB
/
PatrolResource.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
68
69
70
71
72
73
74
75
76
77
78
79
80
package seedu.addressbook.data.PoliceOfficers;
import java.util.Objects;
/**
* Represents a Patrol Resource in the system.
* Guarantees: details are present and not null, field values are validated.
*/
public class PatrolResource implements ReadOnlyPatrolResource {
public PatrolID patrolID;
public State state;
public Case currentCase;
/**
* Assumption: Every field must be present and not null (except current case).
*/
public PatrolResource(PatrolID patrolID, State state, Case currentCase) {
this.patrolID = patrolID;
this.state = state;
this.currentCase = (state.getCurrentState().equals(state.FREE)) ? new Case() : currentCase;
}
public PatrolResource(ReadOnlyPatrolResource source) {
this(source.getPatrolID(), source.getState(), source.getCurrentCase());
}
public Case RA(){
//would generate timestamp and GPS
//sent to HQP 'inbox'
return new Case(); //dummy line
}
public Case RB(){
//would generate timestamp and GPS
//sent to HQP 'inbox'
return new Case();
}
public Case RF(){
//would generate timestamp and GPS
//sent to HQP 'inbox'
return new Case();
}
//@Override
public PatrolID getPatrolID() {
return patrolID;
}
//@Override
public State getState() {
return state;
}
//@Override
public Case getCurrentCase() {
return currentCase;
}
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof ReadOnlyPatrolResource // instanceof handles nulls
&& this.isSameStateAs((ReadOnlyPatrolResource) other));
}
@Override
public int hashCode() {
// use this method for custom fields hashing instead of implementing your own
return Objects.hash(patrolID, state, currentCase);
}
@Override
public String toString() {
return getAsTextShowAll();
}
}