Hello William,
all the new equals methods look like the one below.
At the end in the else clause you return true, but that should really be
false,
otherwise two objects which are not of the same type are equals.
Jörn
On 8/17/11 12:30 AM, [email protected] wrote:
Modified:
incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java
URL:
http://svn.apache.org/viewvc/incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java?rev=1158465&r1=1158464&r2=1158465&view=diff
==============================================================================
---
incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java
(original)
+++
incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/chunker/ChunkSample.java
Tue Aug 16 22:30:53 2011
@@ -195,4 +195,20 @@ public class ChunkSample {
}
return chunkString.toString();
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } else if (obj instanceof ChunkSample) {
+ ChunkSample a = (ChunkSample) obj;
+
+ return Arrays.equals(getSentence(), a.getSentence())
+&& Arrays.equals(getTags(), a.getTags())
+&& Arrays.equals(getPreds(), a.getPreds());
+ } else {
+ return true;
+ }
+ }
+
}