You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/08/10 11:53:14 UTC

svn commit: r1371631 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java

Author: rmuir
Date: Fri Aug 10 09:53:13 2012
New Revision: 1371631

URL: http://svn.apache.org/viewvc?rev=1371631&view=rev
Log:
clean up BS2's Coordinator, use ctor instead of init, make coordFactors final

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java?rev=1371631&r1=1371630&r2=1371631&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/search/BooleanScorer2.java Fri Aug 10 09:53:13 2012
@@ -41,16 +41,16 @@ class BooleanScorer2 extends Scorer {
   private final List<Scorer> prohibitedScorers;
 
   private class Coordinator {
-    float[] coordFactors = null;
-    int maxCoord = 0; // to be increased for each non prohibited scorer
-    int nrMatchers; // to be increased by score() of match counting scorers.
-    
-    void init(boolean disableCoord) { // use after all scorers have been added.
+    final float coordFactors[];
+
+    Coordinator(int maxCoord, boolean disableCoord) {
       coordFactors = new float[optionalScorers.size() + requiredScorers.size() + 1];
       for (int i = 0; i < coordFactors.length; i++) {
         coordFactors[i] = disableCoord ? 1.0f : ((BooleanWeight)weight).coord(i, maxCoord);
       }
     }
+    
+    int nrMatchers; // to be increased by score() of match counting scorers.
   }
 
   private final Coordinator coordinator;
@@ -92,15 +92,13 @@ class BooleanScorer2 extends Scorer {
     if (minNrShouldMatch < 0) {
       throw new IllegalArgumentException("Minimum number of optional scorers should not be negative");
     }
-    coordinator = new Coordinator();
     this.minNrShouldMatch = minNrShouldMatch;
-    coordinator.maxCoord = maxCoord;
 
     optionalScorers = optional;
     requiredScorers = required;    
     prohibitedScorers = prohibited;
+    coordinator = new Coordinator(maxCoord, disableCoord);
     
-    coordinator.init(disableCoord);
     countingSumScorer = makeCountingSumScorer(disableCoord);
   }