-
Notifications
You must be signed in to change notification settings - Fork 0
/
TeamUser.java
75 lines (59 loc) · 1.98 KB
/
TeamUser.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
import java.util.Scanner;
public class TeamUser {
//=========================================================== Properties
private int teamId;
private int userId;
private boolean isAssistantCoach;
private boolean hasBeenHonored;
//=========================================================== Constructors
public TeamUser (int teamId, int userId, boolean isAssistantCoach, boolean hasBeenHonored) {
setTeamId(teamId);
setUserId(userId);
setIsAssistantCoach(isAssistantCoach);
setHasBeenHonored(hasBeenHonored);
}
public TeamUser (Scanner fin) throws Exception {
String[] parts = fin.nextLine().split("\t");
setTeamId(Integer.parseInt(parts[0]));
setUserId(Integer.parseInt(parts[1]));
setIsAssistantCoach(Boolean.parseBoolean(parts[2]));
setHasBeenHonored(Boolean.parseBoolean(parts[3]));
}
//=========================================================== Methods
public boolean equals (Object obj) {
if(!(obj instanceof TeamUser)) return false;
TeamUser t = (TeamUser) obj;
return getEqualsString().equals(t.getEqualsString());
}
private String getEqualsString() {
return teamId + "-" + userId + "-" + isAssistantCoach + "-" + hasBeenHonored;
}
public String toString() {
return "teamId: " + teamId + ", userId: " + userId + ", isAssistantCoach: " + isAssistantCoach + ", hasBeenHonored: " + hasBeenHonored;
}
//=========================================================== Getters/Setters
public int getTeamId() {
return this.teamId;
}
public int getUserId() {
return this.userId;
}
public boolean getIsAssistantCoach() {
return this.isAssistantCoach;
}
public boolean getHasBeenHonored() {
return this.hasBeenHonored;
}
public void setTeamId(int teamId) {
this.teamId = teamId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public void setIsAssistantCoach(boolean isAssistantCoach) {
this.isAssistantCoach = isAssistantCoach;
}
public void setHasBeenHonored(boolean hasBeenHonored) {
this.hasBeenHonored = hasBeenHonored;
}
}