-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComment.java
81 lines (72 loc) · 1.77 KB
/
Comment.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
76
77
78
79
80
81
import java.util.ArrayList;
import java.util.UUID;
/**
* A Comment
* @authors: J TEA: Tessa Neal, Eve Blom, Anna Phan, and Jacqueline Askey
*/
public class Comment {
private String comment;
private UUID user;
private ArrayList<Reply> replies = new ArrayList<Reply>();
/**
* Creates a Comment
* @param comment the actual comment string
* @param user the user of the comment
* @param replies an array list of replies
*/
public Comment(String comment, UUID user, ArrayList<Reply> replies){
this.comment = comment;
this.user = user;
this.replies.addAll(replies);
}
/**
* Creates a Comment
* @param comment the actual comment string
* @param user the user of the comment
*/
public Comment(String comment, UUID user) {
this.comment = comment;
this.user = user;
}
/**
* Returns the Comment
* @return comment
*/
public String getComment(){
return comment;
}
/**
* Returns the User
* @return user
*/
public UUID getUser(){
return user;
}
/**
* Returns the ArrayList Reply
* @return replies
*/
public ArrayList<Reply> getReply(){
return replies;
}
/**
* Returns details of the Comment
* @return A string representation of a Comment
*/
public String toString(){
String result = "User: "+ user + "\nComment: " + comment + "\n";
result += "Replies: \n";
for(Reply reply : replies) {
result += reply;
}
result += "\n";
return result;
}
/**
* Adds a Reply to the ArrayList
* @param reply A reply object
*/
public void addReply(Reply reply) {
replies.add(reply);
}
}