Make data objects clonable (will not copy images)
[nikiroo-utils.git] / src / be / nikiroo / fanfix / data / Paragraph.java
index a731c328ce0a2ef4a0bc373689fe275c2abfb663..7a1a1c448322212cbd09cebdc7180b0f8912b6c4 100644 (file)
@@ -7,7 +7,7 @@ import java.awt.image.BufferedImage;
  * 
  * @author niki
  */
-public class Paragraph {
+public class Paragraph implements Cloneable {
        /**
         * A paragraph type, that will dictate how the paragraph will be handled.
         * 
@@ -139,4 +139,17 @@ public class Paragraph {
        public String toString() {
                return String.format("%s: [%s]", "" + type, "" + content);
        }
+
+       @Override
+       public Paragraph clone() {
+               Paragraph para = null;
+               try {
+                       para = (Paragraph) super.clone();
+               } catch (CloneNotSupportedException e) {
+                       // Did the clones rebel?
+                       System.err.println(e);
+               }
+
+               return para;
+       }
 }