Rework the text parser.
[Sone.git] / src / main / java / net / pterodactylus / sone / text / PlainTextPart.java
index aa6441b..5b717c5 100644 (file)
@@ -17,6 +17,9 @@
 
 package net.pterodactylus.sone.text;
 
+import static com.google.common.base.Objects.equal;
+import static java.lang.String.format;
+
 /**
  * {@link Part} implementation that holds a single piece of text.
  *
@@ -41,14 +44,38 @@ public class PlainTextPart implements Part {
        // PART METHODS
        //
 
-       /**
-        * Returns the text of this part.
-        *
-        * @return The text of this part
-        */
        @Override
        public String getText() {
                return text;
        }
 
+       @Override
+       public boolean isPlainText() {
+               return true;
+       }
+
+       @Override
+       public boolean isFreenetLink() {
+               return false;
+       }
+
+       @Override
+       public int hashCode() {
+               return text.hashCode();
+       }
+
+       @Override
+       public boolean equals(Object object) {
+               if (!(object instanceof PlainTextPart)) {
+                       return false;
+               }
+               PlainTextPart plainTextPart = (PlainTextPart) object;
+               return equal(getText(), plainTextPart.getText());
+       }
+
+       @Override
+       public String toString() {
+               return format("PlainText(%s)", getText());
+       }
+
 }