X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fdata%2FChapter.java;h=86856b0e2c09f5fa6ee1c4faf0f7586c1079dbf7;hb=211f7ddb50f68aa8a999023ef6d63d5756bdace6;hp=551606348843446c00ddc59fc53827e7a3e35aa9;hpb=08fe2e33007063e30fe22dc1d290f8afaa18eb1d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/data/Chapter.java b/src/be/nikiroo/fanfix/data/Chapter.java index 5516063..86856b0 100644 --- a/src/be/nikiroo/fanfix/data/Chapter.java +++ b/src/be/nikiroo/fanfix/data/Chapter.java @@ -14,6 +14,15 @@ public class Chapter implements Iterable { private int number; private List paragraphs = new ArrayList(); private List empty = new ArrayList(); + private long words; + + /** + * Empty constructor, not to use. + */ + @SuppressWarnings("unused") + private Chapter() { + // for serialisation purposes + } /** * Create a new {@link Chapter} with the given information. @@ -78,7 +87,7 @@ public class Chapter implements Iterable { /** * The included paragraphs. * - * @param paragraphes + * @param paragraphs * the paragraphs to set */ public void setParagraphs(List paragraphs) { @@ -88,10 +97,30 @@ public class Chapter implements Iterable { /** * Get an iterator on the {@link Paragraph}s. */ + @Override public Iterator iterator() { return paragraphs == null ? empty.iterator() : paragraphs.iterator(); } + /** + * The number of words in this {@link Chapter}. + * + * @return the number of words + */ + public long getWords() { + return words; + } + + /** + * The number of words in this {@link Chapter}. + * + * @param words + * the number of words to set + */ + public void setWords(long words) { + this.words = words; + } + /** * Display a DEBUG {@link String} representation of this object. */