-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.java
More file actions
94 lines (77 loc) · 2.42 KB
/
Copy pathEvent.java
File metadata and controls
94 lines (77 loc) · 2.42 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
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Random;
/**
* Event Class
* Object that contains unique event code and name.
* Created by an organizer for other helpers to join.
*
* @author ianlo
* @version 1/25/2020
*/
public class Event {
private Random eventCodeGenerator = new Random();
private int eventCode;
private String eventName;
private String organizerPassword;
private String staffPassword;
private ArrayList<Event> eventList = new ArrayList<>();
//constructor dedicated to first-time creation of event
public Event(String name, String organizerPassword, String staffPassword) {
eventName = name;
this.organizerPassword = organizerPassword;
this.staffPassword = staffPassword;
do {
eventCode = eventCodeGenerator.nextInt(1000000);
} while (eventCode < 99999);
}
public void addEvent(Event event) {
eventList.add(event);
}
public void removeEvent(Event event) {
eventList.remove(event);
}
public String getEventName() {
return eventName;
}
public int getEventCode() {
return eventCode;
}
public String getOrganizerPassword() {
return organizerPassword;
}
public String getStaffPassword() {
return staffPassword;
}
public ArrayList<Event> getEventList() {
return eventList;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public void setEventCode(int eventCode) {
this.eventCode = eventCode;
}
public void setOrganizerPassword(String organizerPassword) {
this.organizerPassword = organizerPassword;
}
public void setStaffPassword(String staffPassword) {
this.staffPassword = staffPassword;
}
@Override
public boolean equals(@Nullable Object obj) {
if (obj instanceof Event) {
return ((Event) obj).getEventName().equals(this.getEventName()) &&
((Event) obj).getEventCode() == this.getEventCode();
} else {
return false;
}
}
@NonNull
@Override
public String toString() {
return String.format("Event[%s, %d]", this.getEventName(), this.getEventCode());
}
}