-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUser.java
51 lines (33 loc) · 1.15 KB
/
User.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
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.JOptionPane;
public class User {
String userName;
String pass;
ArrayList<Post> userPosts;
ArrayList<String> following;
ArrayList<DirectMessage> directMessages;
User(String userName, String pass) {
this.userName = userName;
this.pass = pass;
this.userPosts = new ArrayList<>();
this.following = new ArrayList<>();
this.directMessages = new ArrayList<>();
}
public String showUserName() {
return userName;
}
public void userLike(Post post) {
if(!post.userLike.contains(this)) {
post.userLike.add(this);
}
}
public void userComments(Post post) {
post.comments.add(JOptionPane.showInputDialog("Enter your comment:"));
}
public void sendMessage(User destinationUser) {
DirectMessage directMessage = new DirectMessage(JOptionPane.showInputDialog("Enter your message: "), this);
destinationUser.directMessages.add( directMessage);
directMessages.add(directMessage);
}
}