-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserAccount.java
More file actions
74 lines (61 loc) · 1.99 KB
/
UserAccount.java
File metadata and controls
74 lines (61 loc) · 1.99 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
import java.util.ArrayList;
/**
* Team Project
*
* UserAccount.java
*
* @author Huy Vu, Yanxin Yu - CS180 - L22
* @version 28 March 2024
*/
public class UserAccount implements UserAccountInterface {
private Profile userProfile;
private ArrayList<String> friendList;
private ArrayList<String> blockList;
public UserAccount(Profile userProfile) {
this.userProfile = userProfile;
this.friendList = new ArrayList<>();
this.blockList = new ArrayList<>();
}
public Profile getUserProfile() {
return userProfile;
}
public ArrayList<String> getFriendList() {
return friendList;
}
public void setFriendList(ArrayList<String> friendList) {
this.friendList = friendList;
}
public ArrayList<String> getBlockList() {
return blockList;
}
public void setBlockList(ArrayList<String> blockList) {
this.blockList = blockList;
}
public String toString() {
String friend = "";
String blockUser = "";
if (this.friendList.size() != 0) {
for (int i = 0; i < this.friendList.size(); i++) {
String friendName = this.friendList.get(i);
if (friendName != null && !friendName.isEmpty()) {
friend += friendName;
if (i < (this.friendList.size() - 1)) {
friend += " ";
}
}
}
}
if (this.blockList.size() != 0) {
for (int i = 0; i < this.blockList.size(); i++) {
String blockedUser = this.blockList.get(i);
if (blockedUser != null && !blockedUser.isEmpty()) {
blockUser += blockedUser;
if (i < (this.blockList.size() - 1)) {
blockUser += " ";
}
}
}
}
return this.userProfile.toString() + ";FriendList:[" + friend + "];BlockList:[" + blockUser + "]";
}
}