44c0de105eef25831286f57447261b82ee98b6ef
[gofetch.git] / src / be / nikiroo / gofetch / data / Comment.java
1 package be.nikiroo.gofetch.data;
2
3 import java.util.ArrayList;
4 import java.util.Iterator;
5 import java.util.List;
6
7 public class Comment implements Iterable<Comment> {
8 private String id;
9 private String author;
10 private String title;
11 private String date;
12 private String content;
13 private List<Comment> children;
14
15 public Comment(String id, String author, String title, String date,
16 String content) {
17 this.id = id;
18 this.author = author;
19 this.title = title;
20 this.date = date;
21 this.content = content;
22 this.children = new ArrayList<Comment>();
23 }
24
25 public void add(Comment comment) {
26 children.add(comment);
27 }
28
29 public void addAll(List<Comment> comments) {
30 children.addAll(comments);
31 }
32
33 /**
34 * @return the id
35 */
36 public String getId() {
37 return id;
38 }
39
40 /**
41 * @return the author
42 */
43 public String getAuthor() {
44 return author;
45 }
46
47 /**
48 * @return the title
49 */
50 public String getTitle() {
51 return title;
52 }
53
54 /**
55 * @return the date
56 */
57 public String getDate() {
58 return date;
59 }
60
61 /**
62 * @return the content
63 */
64 public String getContent() {
65 return content;
66 }
67
68 public boolean isEmpty() {
69 return children.isEmpty()
70 && ("" + author + title + content).trim().isEmpty();
71 }
72
73 @Override
74 public Iterator<Comment> iterator() {
75 return children.iterator();
76 }
77 }