forked from raghaddmahgoub/OOP-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.java
More file actions
168 lines (149 loc) · 4.67 KB
/
User.java
File metadata and controls
168 lines (149 loc) · 4.67 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import java.text.SimpleDateFormat;
import java.util.*;
import javax.sound.midi.Soundbank;
import java.time.LocalDateTime;
public class User {
//////////////////////////////////////////////////////////////////attributes/////////////////////////////////////
public enum GenderOptions {
MALE, FEMALE, NONE
}
private static int Number_Of_Users = 0;
private int User_ID;
private static int newID = 1;
private String User_Name;
private String Name;
private String Email;
private String Password;
private GenderOptions Gender = GenderOptions.NONE;
private Date Birthdate;
private Long PhoneNumber;
private String userPrivacy;
ArrayList<Conversation> Conversations = new ArrayList<>();
public ArrayList<Conversation> getConversations() {
return Conversations;
}
public void setConversations(Conversation con) {
Conversations.add(con);
}
ArrayList <User> Friends = new ArrayList <User>();
ArrayList<FriendShip> relations = new ArrayList<FriendShip>();
private ArrayList <FriendRequest> friendRequests = new ArrayList <FriendRequest>();
private final ArrayList<Postnotification> postnotifications = new ArrayList<Postnotification>();
private ArrayList<Post> Posts = new ArrayList<Post>();
private Messenger messenger;
//////////////////////////////////////////////////////////constructors////////////////////////////////////////////////
public User(String User_Name, String Password){
this.User_Name = User_Name;
this.Password = Password;
this.User_ID = newID;
newID++;
}
public void AddFriend(User New_Friend_User) {
Friends.add(New_Friend_User);
}
public User(String User_Name, String Password, String Email){
User_ID=Number_Of_Users;
Number_Of_Users++;
this.User_Name = User_Name;
this.Password = Password;
this.Email = Email;
this.User_ID = newID;
newID++;
}
////////////////////////////////////////////////////////////methods//////////////////////////////////////////////////////////////
public ArrayList<Postnotification> getPostNotifications() {
return postnotifications;
}
public void addPostNotifiObject(Postnotification postnotification) {
this.postnotifications.add(postnotification);
}
public ArrayList<FriendRequest> getFriendRequests() {
return friendRequests;
}
public void setFriendRequest(FriendRequest friendRequest){
friendRequests.add(friendRequest);
}
public ArrayList<Post> getAllPosts() {
return Posts;
}
public Post getPost(int postId) {
return getAllPosts().get(postId);
}
public void addApost(Post post) {
Posts.add(post) ;
}
public ArrayList<User>getFriends() {
return Friends;
}
public int getUserID() {
return this.User_ID;
}
public void RemoveFriend(User Friend_User){
Friends.remove(Friend_User);
}
public String getUserName() {
return this.User_Name;
}
public void setUser_Name(String user_name) {
this.User_Name = user_name;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getEmail() {
return Email;
}
public void setEmail(String email) {
Email = email;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public GenderOptions getGender() {
return Gender;
}
public void setGender(GenderOptions gender) {
Gender = gender;
}
public Date getBirthdate(){
return Birthdate;
}
public String getBirthdateString() {
SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd");
String formattedDate = dateFormat.format(getBirthdate());
return formattedDate;
}
public void setBirthdate(Date birthdate) {
Birthdate = birthdate;
}
public Long getPhoneNumber() {
return PhoneNumber;
}
public void setPhoneNumber(Long phoneNumber) {
PhoneNumber = phoneNumber;
}
public String getUserPrivacy() {
return userPrivacy;
}
public void setUserPrivacy(String userPrivacy) {
this.userPrivacy = userPrivacy;
}
public ArrayList<FriendShip> getRelations() {
return relations;
}
public void addFriend (User friend){
Friends.add(friend);
}
public Messenger getMessenger() {
return messenger;
}
public void setMessenger(User user) {
this.messenger = new Messenger(user);
}
}