X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fdata%2FParagraph.java;h=1a7429a403a8a6f0bc0742fb29f14ad2d7811da5;hb=211f7ddb50f68aa8a999023ef6d63d5756bdace6;hp=feb949caf91c87d79e2471f6eed2dc6aceef8fa3;hpb=08fe2e33007063e30fe22dc1d290f8afaa18eb1d;p=nikiroo-utils.git diff --git a/src/be/nikiroo/fanfix/data/Paragraph.java b/src/be/nikiroo/fanfix/data/Paragraph.java index feb949c..1a7429a 100644 --- a/src/be/nikiroo/fanfix/data/Paragraph.java +++ b/src/be/nikiroo/fanfix/data/Paragraph.java @@ -28,6 +28,25 @@ public class Paragraph { private ParagraphType type; private String content; + private long words; + + /** + * Empty constructor, not to use. + */ + @SuppressWarnings("unused") + private Paragraph() { + // for serialisation purposes + } + + /** + * Create a new {@link Paragraph} with the given image. + * + * @param imageUrl + * the image as an URL + */ + public Paragraph(URL imageUrl) { + this(ParagraphType.IMAGE, imageUrl.toString(), 0); + } /** * Create a new {@link Paragraph} with the given values. @@ -36,24 +55,13 @@ public class Paragraph { * the {@link ParagraphType} * @param content * the content of this paragraph + * @param words + * the number of words */ - public Paragraph(ParagraphType type, String content) { + public Paragraph(ParagraphType type, String content, long words) { this.type = type; this.content = content; - } - - /** - * Create a new {@link Paragraph} with the given image. - * - * @param support - * the support that will be used to fetch the image via - * {@link Paragraph#getContentImage()}. - * @param content - * the content image of this paragraph - */ - public Paragraph(URL imageUrl) { - this.type = ParagraphType.IMAGE; - this.content = imageUrl.toString(); + this.words = words; } /** @@ -94,6 +102,25 @@ public class Paragraph { this.content = content; } + /** + * The number of words in this {@link Paragraph}. + * + * @return the number of words + */ + public long getWords() { + return words; + } + + /** + * The number of words in this {@link Paragraph}. + * + * @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. */