Version 0.2.0: supports LWN, quotes, <br>s
[gofetch.git] / src / be / nikiroo / gofetch / data / Comment.java
CommitLineData
73785268
NR
1package be.nikiroo.gofetch.data;
2
3import java.util.ArrayList;
4import java.util.Iterator;
5import java.util.List;
6
7public class Comment implements Iterable<Comment> {
8 private String id;
9 private String author;
10 private String title;
11 private String date;
27008a87 12 private List<String> lines;
73785268
NR
13 private List<Comment> children;
14
15 public Comment(String id, String author, String title, String date,
27008a87 16 List<String> lines) {
73785268
NR
17 this.id = id;
18 this.author = author;
19 this.title = title;
20 this.date = date;
27008a87 21 this.lines = lines;
73785268
NR
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 */
27008a87
NR
64 public List<String> getContentLines() {
65 return lines;
73785268
NR
66 }
67
68 public boolean isEmpty() {
27008a87
NR
69 return children.isEmpty() && lines.isEmpty()
70 && ("" + author + title).trim().isEmpty();
73785268
NR
71 }
72
73 @Override
74 public Iterator<Comment> iterator() {
75 return children.iterator();
76 }
77}