Wordcount (including UI), date of creation
[nikiroo-utils.git] / src / be / nikiroo / fanfix / data / Paragraph.java
index feb949caf91c87d79e2471f6eed2dc6aceef8fa3..e409c286ae2949be6242c772b6fb7a1783e6a51f 100644 (file)
@@ -28,19 +28,7 @@ public class Paragraph {
 
        private ParagraphType type;
        private String content;
-
-       /**
-        * Create a new {@link Paragraph} with the given values.
-        * 
-        * @param type
-        *            the {@link ParagraphType}
-        * @param content
-        *            the content of this paragraph
-        */
-       public Paragraph(ParagraphType type, String content) {
-               this.type = type;
-               this.content = content;
-       }
+       private long words;
 
        /**
         * Create a new {@link Paragraph} with the given image.
@@ -52,8 +40,23 @@ public class Paragraph {
         *            the content image of this paragraph
         */
        public Paragraph(URL imageUrl) {
-               this.type = ParagraphType.IMAGE;
-               this.content = imageUrl.toString();
+               this(ParagraphType.IMAGE, imageUrl.toString(), 0);
+       }
+
+       /**
+        * Create a new {@link Paragraph} with the given values.
+        * 
+        * @param type
+        *            the {@link ParagraphType}
+        * @param content
+        *            the content of this paragraph
+        * @param words
+        *            the number of words
+        */
+       public Paragraph(ParagraphType type, String content, long words) {
+               this.type = type;
+               this.content = content;
+               this.words = words;
        }
 
        /**
@@ -94,6 +97,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.
         */