Generify more Comparable interface declarations

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@826016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-10-16 17:47:14 +00:00
parent ad6bbdd02e
commit a0776e5cd0
6 changed files with 15 additions and 18 deletions

View File

@ -32,7 +32,7 @@ import java.util.Map;
* or each pair as its own field, etc., - and this of course must match the way the
* searched index was constructed.
*/
public class QualityQuery implements Comparable {
public class QualityQuery implements Comparable<QualityQuery> {
private String queryID;
private Map nameValPairs;
@ -71,8 +71,7 @@ public class QualityQuery implements Comparable {
/* for a nicer sort of input queries before running them.
* Try first as ints, fall back to string if not int. */
public int compareTo(Object o) {
QualityQuery other = (QualityQuery) o;
public int compareTo(QualityQuery other) {
try {
// compare as ints when ids ints
int n = Integer.parseInt(queryID);

View File

@ -27,7 +27,7 @@ import org.apache.lucene.search.Query;
public abstract class SimpleTerm
extends SrndQuery
implements DistanceSubQuery, Comparable
implements DistanceSubQuery, Comparable<SimpleTerm>
{
public SimpleTerm(boolean q) {quoted = q;}
@ -39,9 +39,8 @@ public abstract class SimpleTerm
public abstract String toStringUnquoted();
public int compareTo(Object o) {
public int compareTo(SimpleTerm ost) {
/* for ordering terms and prefixes before using an index, not used */
SimpleTerm ost = (SimpleTerm) o;
return this.toStringUnquoted().compareTo( ost.toStringUnquoted());
}

View File

@ -24,7 +24,7 @@ import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
// TODO: break into separate freq and prox writers as
// codecs; make separate container (tii/tis/skip/*) that can
// be configured as any number of files 1..N
final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implements Comparable {
final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implements Comparable<FreqProxTermsWriterPerField> {
final FreqProxTermsWriterPerThread perThread;
final TermsHashPerField termsHashPerField;
@ -56,8 +56,7 @@ final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implem
void skippingLongTerm() throws IOException {}
public int compareTo(Object other0) {
FreqProxTermsWriterPerField other = (FreqProxTermsWriterPerField) other0;
public int compareTo(FreqProxTermsWriterPerField other) {
return fieldInfo.name.compareTo(other.fieldInfo.name);
}

View File

@ -567,7 +567,7 @@ final class IndexFileDeleter {
* equals.
*/
final private static class CommitPoint extends IndexCommit implements Comparable {
final private static class CommitPoint extends IndexCommit implements Comparable<CommitPoint> {
long gen;
Collection files;
@ -637,8 +637,7 @@ final class IndexFileDeleter {
return deleted;
}
public int compareTo(Object obj) {
CommitPoint commit = (CommitPoint) obj;
public int compareTo(CommitPoint commit) {
if (gen < commit.gen) {
return -1;
} else if (gen > commit.gen) {

View File

@ -25,7 +25,7 @@ import org.apache.lucene.search.Similarity;
* just look at the length for the field (docState.length)
* and record the norm. */
final class NormsWriterPerField extends InvertedDocEndConsumerPerField implements Comparable {
final class NormsWriterPerField extends InvertedDocEndConsumerPerField implements Comparable<NormsWriterPerField> {
final NormsWriterPerThread perThread;
final FieldInfo fieldInfo;
@ -56,8 +56,8 @@ final class NormsWriterPerField extends InvertedDocEndConsumerPerField implement
upto = 0;
}
public int compareTo(Object other) {
return fieldInfo.name.compareTo(((NormsWriterPerField) other).fieldInfo.name);
public int compareTo(NormsWriterPerField other) {
return fieldInfo.name.compareTo(other.fieldInfo.name);
}
void finish() {

View File

@ -25,6 +25,7 @@ import java.util.Map;
import java.util.SortedSet;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
@ -51,13 +52,13 @@ public class TestTermVectorsReader extends LuceneTestCase {
super(s);
}
private class TestToken implements Comparable {
private class TestToken implements Comparable<TestToken> {
String text;
int pos;
int startOffset;
int endOffset;
public int compareTo(Object other) {
return pos - ((TestToken) other).pos;
public int compareTo(TestToken other) {
return pos - other.pos;
}
}