mirror of https://github.com/apache/lucene.git
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:
parent
1ebfc379fd
commit
c79abd35dd
|
@ -62,7 +62,7 @@ package org.apache.lucene.index;
|
||||||
Note that terms may represent more than words from text fields, but also
|
Note that terms may represent more than words from text fields, but also
|
||||||
things like dates, email addresses, urls, etc. */
|
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 field;
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
|
@ -98,6 +98,10 @@ public final class Term implements java.io.Serializable {
|
||||||
return field.hashCode() + text.hashCode();
|
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
|
/** 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
|
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.
|
argument, and greater than zero iff this term belongs after the argument.
|
||||||
|
|
Loading…
Reference in New Issue