-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticipant.java
49 lines (40 loc) · 1.36 KB
/
Participant.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
import java.util.ArrayList;
public class Participant {
private String id;
private String name;
private String email;
private String phone;
private String address;
private ArrayList<String> currentEvents;
Participant(String name, String phone, String email, String address) {
this.id = UID.generateParticipantUID();
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
this.currentEvents = new ArrayList<String>();
}
public String getId() {
return this.id;
}
public Participant updateParticipant(String name, String phone, String email, String address) {
if (!name.isBlank())
this.name = name;
if (!phone.isBlank())
this.phone = phone;
if (!email.isBlank())
this.email = email;
if (!address.isBlank())
this.address = address;
return this;
}
public void registerParticipanttoEvent(String eventId) {
if (this.currentEvents.indexOf(eventId) == -1)
this.currentEvents.add(eventId);
}
@Override
public String toString() {
return this.id + ", " + this.name + ", " + this.email + ", " + this.phone + ", " + this.address + ", "
+ this.currentEvents;
}
}