X-Git-Url: http://git.nikiroo.be/?p=gofetch.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Fdata%2FStory.java;h=a2ad7d3b9e3a3660d18c951c6c3904b49a91c6b6;hp=9fd4c1495b882ccf8591489cb901137b01271418;hb=72f39832a7b425003c1d717afcfb5a9cf7d3405b;hpb=90942239ab229fb01f757b22f494f0d95a4c0a69 diff --git a/src/be/nikiroo/gofetch/data/Story.java b/src/be/nikiroo/gofetch/data/Story.java index 9fd4c14..a2ad7d3 100644 --- a/src/be/nikiroo/gofetch/data/Story.java +++ b/src/be/nikiroo/gofetch/data/Story.java @@ -130,4 +130,25 @@ public class Story { public void setComments(List comments) { this.comments = comments; } + + /** + * Find a comment or sub-comment by its id. + * + * @param id + * the id to look for F + * @return this if it has the given id, or a child of this if the child have + * the given id, or NULL if not + */ + public Comment getCommentById(String id) { + if (id != null && comments != null) { + for (Comment comment : comments) { + Comment found = comment.getById(id); + if (found != null) { + return found; + } + } + } + + return null; + } } \ No newline at end of file