Changed Term to implement Comparable.

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150243 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Doug Cutting 2004-03-24 17:32:49 +00:00
parent 1ebfc379fd
commit c79abd35dd
1 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,7 @@ package org.apache.lucene.index;
Note that terms may represent more than words from text fields, but also
things like dates, email addresses, urls, etc. */
public final class Term implements java.io.Serializable {
public final class Term implements Comparable, java.io.Serializable {
String field;
String text;
@ -98,6 +98,10 @@ public final class Term implements java.io.Serializable {
return field.hashCode() + text.hashCode();
}
public int compareTo(Object other) {
return compareTo((Term)other);
}
/** Compares two terms, returning an integer which is less than zero iff this
term belongs after the argument, equal zero iff this term is equal to the
argument, and greater than zero iff this term belongs after the argument.