Match implements Comparable<Match>, Iterable<Mark> { @Override public int compareTo(Match other) { int diff = other.getTokenCount() - getTokenCount(); if (diff != 0) { return diff; } return getFirstMark().compareTo(other.getFirstMark()); } Match(int tokenCount, Mark first, Mark second);  Match(int tokenCount, TokenEntry first, TokenEntry second); int getMarkCount(); int getLineCount(); int getTokenCount(); String getSourceCodeSlice(); @Override Iterator<Mark> iterator(); @Override int compareTo(Match other); Mark getFirstMark(); Mark getSecondMark(); @Override String toString(); Set<Mark> getMarkSet(); int getEndIndex(); void setMarkSet(Set<Mark> markSet); void setLabel(String aLabel); String getLabel(); void addTokenEntry(TokenEntry entry); static final Comparator<Match> MATCHES_COMPARATOR; static final Comparator<Match> LINES_COMPARATOR; static final Comparator<Match> LABEL_COMPARATOR; static final Comparator<Match> LENGTH_COMPARATOR; }
@Test public void testCompareTo() { Match m1 = new Match(1, new TokenEntry("public", "/var/Foo.java", 1), new TokenEntry("class", "/var/Foo.java", 1)); Match m2 = new Match(2, new TokenEntry("Foo", "/var/Foo.java", 1), new TokenEntry("{", "/var/Foo.java", 1)); assertTrue(m2.compareTo(m1) < 0); }