lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r826016 - in /lucene/java/trunk: contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/ contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/ src/java/org/apache/lucene/index/ src/test/org/apache/lucene/index/
Date Fri, 16 Oct 2009 17:47:15 GMT
Author: uschindler
Date: Fri Oct 16 17:47:14 2009
New Revision: 826016

URL: http://svn.apache.org/viewvc?rev=826016&view=rev
Log:
Generify more Comparable interface declarations

Modified:
    lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
    lucene/java/trunk/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
    lucene/java/trunk/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileDeleter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/NormsWriterPerField.java
    lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java

Modified: lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
(original)
+++ lucene/java/trunk/contrib/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
Fri Oct 16 17:47:14 2009
@@ -32,7 +32,7 @@
  * 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 @@
 
   /* 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);

Modified: lucene/java/trunk/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
(original)
+++ lucene/java/trunk/contrib/surround/src/java/org/apache/lucene/queryParser/surround/query/SimpleTerm.java
Fri Oct 16 17:47:14 2009
@@ -27,7 +27,7 @@
 
 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 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());
   }
   

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java Fri
Oct 16 17:47:14 2009
@@ -24,7 +24,7 @@
 // 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 @@
 
   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);
   }
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileDeleter.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileDeleter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexFileDeleter.java Fri Oct 16 17:47:14
2009
@@ -567,7 +567,7 @@
    * 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 @@
       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) {

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/NormsWriterPerField.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/NormsWriterPerField.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/NormsWriterPerField.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/NormsWriterPerField.java Fri Oct 16
17:47:14 2009
@@ -25,7 +25,7 @@
  *  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 @@
     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() {

Modified: lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java?rev=826016&r1=826015&r2=826016&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/index/TestTermVectorsReader.java Fri Oct
16 17:47:14 2009
@@ -25,6 +25,7 @@
 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 @@
     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;
     }
   }
 



Mime
View raw message