lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r825989 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
Date Fri, 16 Oct 2009 16:30:19 GMT
Author: uschindler
Date: Fri Oct 16 16:30:19 2009
New Revision: 825989

URL: http://svn.apache.org/viewvc?rev=825989&view=rev
Log:
LUCENE-1985: More Java5 fixes

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=825989&r1=825988&r2=825989&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Fri Oct 16 16:30:19 2009
@@ -14,7 +14,7 @@
 
 API Changes
 
-* LUCENE-1257, LUCENE-1984,...: Port to Java 1.5 [not yet finished].
+* LUCENE-1257, LUCENE-1984, LUCENE-1985, ...: Port to Java 1.5 [not yet finished].
   (Uwe Schindler, Robert Muir, Karl Wettin, Paul Elschot, Kay Kay)
 
 * LUCENE-1944: Remove (all) deprecated methods/constructors taking

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java?rev=825989&r1=825988&r2=825989&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/DisjunctionMaxQuery.java Fri Oct 16
16:30:19 2009
@@ -103,8 +103,8 @@
     /* Construct the Weight for this Query searched by searcher.  Recursively construct subquery
weights. */
     public DisjunctionMaxWeight(Searcher searcher) throws IOException {
       this.similarity = searcher.getSimilarity();
-      for (Iterator<Query> iter = disjuncts.iterator(); iter.hasNext();) {
-        weights.add(((Query) iter.next()).createWeight(searcher));
+      for (Query disjunctQuery : disjuncts) {
+        weights.add(disjunctQuery.createWeight(searcher));
       }
     }
 
@@ -120,8 +120,8 @@
     @Override
     public float sumOfSquaredWeights() throws IOException {
       float max = 0.0f, sum = 0.0f;
-      for (Iterator<Weight> iter = weights.iterator(); iter.hasNext();) {
-        float sub = ((Weight) iter.next()).sumOfSquaredWeights();
+      for (Weight currentWeight : weights) {
+        float sub = currentWeight.sumOfSquaredWeights();
         sum += sub;
         max = Math.max(max, sub);
         
@@ -134,8 +134,8 @@
     @Override
     public void normalize(float norm) {
       norm *= getBoost();  // Incorporate our boost
-      for (Iterator<Weight> iter = weights.iterator(); iter.hasNext();) {
-        ((Weight) iter.next()).normalize(norm);
+      for (Weight wt : weights) {
+        wt.normalize(norm);
       }
     }
 
@@ -145,8 +145,7 @@
         boolean topScorer) throws IOException {
       Scorer[] scorers = new Scorer[weights.size()];
       int idx = 0;
-      for (Iterator<Weight> iter = weights.iterator(); iter.hasNext();) {
-        Weight w = (Weight) iter.next();
+      for (Weight w : weights) {
         Scorer subScorer = w.scorer(reader, true, false);
         if (subScorer != null && subScorer.nextDoc() != DocIdSetIterator.NO_MORE_DOCS)
{
           scorers[idx++] = subScorer;
@@ -164,8 +163,8 @@
       ComplexExplanation result = new ComplexExplanation();
       float max = 0.0f, sum = 0.0f;
       result.setDescription(tieBreakerMultiplier == 0.0f ? "max of:" : "max plus " + tieBreakerMultiplier
+ " times others of:");
-      for (Iterator<Weight> iter = weights.iterator(); iter.hasNext();) {
-        Explanation e = ((Weight) iter.next()).explain(reader, doc);
+      for (Weight wt : weights) {
+        Explanation e = wt.explain(reader, doc);
         if (e.isMatch()) {
           result.setMatch(Boolean.TRUE);
           result.addDetail(e);
@@ -225,8 +224,8 @@
   // inherit javadoc
   @Override
   public void extractTerms(Set<Term> terms) {
-    for (Iterator iter = disjuncts.iterator(); iter.hasNext();) {
-      ((Query) iter.next()).extractTerms(terms);
+    for (Query query : disjuncts) {
+      query.extractTerms(terms);
     }
   }
 



Mime
View raw message