From: <dfl...@us...> - 2013-08-19 09:53:17
|
Revision: 4025 http://sourceforge.net/p/dl-learner/code/4025 Author: dfleischhacker Date: 2013-08-19 09:53:14 +0000 (Mon, 19 Aug 2013) Log Message: ----------- TR API: Add equals and hashCode to TextDocument Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/TextDocument.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/TextDocument.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/TextDocument.java 2013-08-19 09:52:57 UTC (rev 4024) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/index/TextDocument.java 2013-08-19 09:53:14 UTC (rev 4025) @@ -8,6 +8,12 @@ public class TextDocument implements Document { private String content; + + /** + * Initializes a text document with the given content. + * + * @param content content of this text document + */ public TextDocument(String content) { this.content = content; } @@ -26,4 +32,27 @@ public String getRawContent() { return content; } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + TextDocument that = (TextDocument) o; + + if (!content.equals(that.content)) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + return content.hashCode(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |