lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r829319 - in /lucene/java/trunk/src/java/org/apache/lucene/search: FieldDoc.java FieldDocSortedHitQueue.java
Date Sat, 24 Oct 2009 08:05:22 GMT
Author: uschindler
Date: Sat Oct 24 08:05:22 2009
New Revision: 829319

URL: http://svn.apache.org/viewvc?rev=829319&view=rev
Log:
Remove generics for Comparable in FieldDoc again, because we have no type and <?> makes
more problems than it helps

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/FieldDoc.java
    lucene/java/trunk/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/FieldDoc.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FieldDoc.java?rev=829319&r1=829318&r2=829319&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FieldDoc.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FieldDoc.java Sat Oct 24 08:05:22
2009
@@ -45,7 +45,7 @@
 	 * @see Sort
 	 * @see Searcher#search(Query,Filter,int,Sort)
 	 */
-	public Comparable<?>[] fields;
+	public Comparable[] fields;
 
 	/** Expert: Creates one of these objects with empty sort information. */
 	public FieldDoc (int doc, float score) {
@@ -53,7 +53,7 @@
 	}
 
 	/** Expert: Creates one of these objects with the given sort information. */
-	public FieldDoc (int doc, float score, Comparable<?>[] fields) {
+	public FieldDoc (int doc, float score, Comparable[] fields) {
 		super (doc, score);
 		this.fields = fields;
 	}

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java?rev=829319&r1=829318&r2=829319&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/FieldDocSortedHitQueue.java Sat Oct
24 08:05:22 2009
@@ -94,8 +94,8 @@
    * @param b ScoreDoc
    * @return <code>true</code> if document <code>a</code> should
be sorted after document <code>b</code>.
    */
-  @SuppressWarnings("unchecked")
-  protected final boolean lessThan (final FieldDoc docA, final FieldDoc docB) {
+  @SuppressWarnings("unchecked") @Override
+  protected final boolean lessThan(final FieldDoc docA, final FieldDoc docB) {
     final int n = fields.length;
     int c = 0;
     for (int i=0; i<n && c==0; ++i) {
@@ -106,17 +106,17 @@
         // null values need to be sorted first, because of how FieldCache.getStringIndex()
         // works - in that routine, any documents without a value in the given field are
         // put first.  If both are null, the next SortField is used
-        if (s1 == null) c = (s2==null) ? 0 : -1;
-        else if (s2 == null) c = 1;  // 
-        else if (fields[i].getLocale() == null) {
+        if (s1 == null) {
+          c = (s2 == null) ? 0 : -1;
+        } else if (s2 == null) {
+          c = 1;
+        } else if (fields[i].getLocale() == null) {
           c = s1.compareTo(s2);
         } else {
           c = collators[i].compare(s1, s2);
         }
       } else {
-        // the casts are a no-ops, its only there to make the
-        // compiler happy because of unbounded generics:
-        c = ((Comparable) docA.fields[i]).compareTo((Comparable) docB.fields[i]);
+        c = docA.fields[i].compareTo(docB.fields[i]);
         if (type == SortField.SCORE) {
           c = -c;
         }



Mime
View raw message