@Test public void testEquals() { Assert.assertFalse(createGoldSample() == createGoldSample()); Assert.assertTrue(createGoldSample().equals(createGoldSample())); Assert.assertFalse(createPredSample().equals(createGoldSample())); Assert.assertFalse(createPredSample().equals(new Object())); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TokenSample) { TokenSample a = (TokenSample) obj; return getText().equals(a.getText()) && Arrays.equals(getTokenSpans(), a.getTokenSpans()); } return false; }
TokenSample implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TokenSample) { TokenSample a = (TokenSample) obj; return getText().equals(a.getText()) && Arrays.equals(getTokenSpans(), a.getTokenSpans()); } return false; } }
TokenSample implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TokenSample) { TokenSample a = (TokenSample) obj; return getText().equals(a.getText()) && Arrays.equals(getTokenSpans(), a.getTokenSpans()); } return false; } TokenSample(String text, Span[] tokenSpans);  TokenSample(Detokenizer detokenizer, String[] tokens); }
TokenSample implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TokenSample) { TokenSample a = (TokenSample) obj; return getText().equals(a.getText()) && Arrays.equals(getTokenSpans(), a.getTokenSpans()); } return false; } TokenSample(String text, Span[] tokenSpans);  TokenSample(Detokenizer detokenizer, String[] tokens); String getText(); Span[] getTokenSpans(); @Override String toString(); static TokenSample parse(String sampleString, String separatorChars); @Override int hashCode(); @Override boolean equals(Object obj); }
TokenSample implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TokenSample) { TokenSample a = (TokenSample) obj; return getText().equals(a.getText()) && Arrays.equals(getTokenSpans(), a.getTokenSpans()); } return false; } TokenSample(String text, Span[] tokenSpans);  TokenSample(Detokenizer detokenizer, String[] tokens); String getText(); Span[] getTokenSpans(); @Override String toString(); static TokenSample parse(String sampleString, String separatorChars); @Override int hashCode(); @Override boolean equals(Object obj); static final String DEFAULT_SEPARATOR_CHARS; }