Rework the text parser.
[Sone.git] / src / main / java / net / pterodactylus / sone / text / PostPart.java
index 6241b7a..bf974e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - PostLinkPart.java - Copyright © 2011–2012 David Roden
+ * Sone - PostPart.java - Copyright © 2011–2013 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
 
 package net.pterodactylus.sone.text;
 
+import static com.google.common.base.Objects.equal;
+
 import net.pterodactylus.sone.data.Post;
 
 /**
@@ -43,6 +45,16 @@ public class PostPart implements Part {
        // ACCESSORS
        //
 
+       @Override
+       public boolean isPlainText() {
+               return false;
+       }
+
+       @Override
+       public boolean isFreenetLink() {
+               return false;
+       }
+
        /**
         * Returns the post referenced by this part.
         *
@@ -56,12 +68,23 @@ public class PostPart implements Part {
        // PART METHODS
        //
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public String getText() {
                return post.getText();
        }
 
+       @Override
+       public int hashCode() {
+               return getPost().hashCode();
+       }
+
+       @Override
+       public boolean equals(Object object) {
+               if (!(object instanceof PostPart)) {
+                       return false;
+               }
+               PostPart postPart = (PostPart) object;
+               return equal(getPost(), postPart.getPost());
+       }
+
 }