From c79abd35dd2f9a70a992a3505ba44cdfe6eccf60 Mon Sep 17 00:00:00 2001 From: Doug Cutting Date: Wed, 24 Mar 2004 17:32:49 +0000 Subject: [PATCH] Changed Term to implement Comparable. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150243 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/index/Term.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/lucene/index/Term.java b/src/java/org/apache/lucene/index/Term.java index 9c155efeb3e..d6d3f422048 100644 --- a/src/java/org/apache/lucene/index/Term.java +++ b/src/java/org/apache/lucene/index/Term.java @@ -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.