Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
53   138   26   4.82
34   94   0.49   11
11     2.36  
1    
 
  ConjunctionScorer       Line # 24 53 26 96.9% 0.96938777
 
  (39)
 
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2006 The Apache Software Foundation
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10    * http://www.apache.org/licenses/LICENSE-2.0
11    *
12    * Unless required by applicable law or agreed to in writing, software
13    * distributed under the License is distributed on an "AS IS" BASIS,
14    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    * See the License for the specific language governing permissions and
16    * limitations under the License.
17    */
18   
19    import java.io.IOException;
20    import java.util.Arrays;
21    import java.util.Comparator;
22   
23    /** Scorer for conjunctions, sets of queries, all of which are required. */
 
24    class ConjunctionScorer extends Scorer {
25    private Scorer[] scorers = new Scorer[2];
26    private int length = 0;
27    private int first = 0;
28    private int last = -1;
29    private boolean firstTime = true;
30    private boolean more = true;
31    private float coord;
32   
 
33  43217 toggle public ConjunctionScorer(Similarity similarity) {
34  43217 super(similarity);
35    }
36   
 
37  117596 toggle final void add(Scorer scorer) {
38  117596 if (length >= scorers.length) {
39    // grow the array
40  25743 Scorer[] temps = new Scorer[scorers.length * 2];
41  25743 System.arraycopy(scorers, 0, temps, 0, length);
42  25743 scorers = temps;
43    }
44  117596 last += 1;
45  117596 length += 1;
46  117596 scorers[last] = scorer;
47    }
48   
 
49  45241 toggle public int doc() { return scorers[first].doc(); }
50   
 
51  50778 toggle public boolean next() throws IOException {
52  50778 if (firstTime) {
53  41399 init(true);
54  9379 } else if (more) {
55  9379 more = scorers[last].next(); // trigger further scanning
56    }
57  50778 return doNext();
58    }
59   
 
60  55835 toggle private boolean doNext() throws IOException {
61  122306 while (more && scorers[first].doc() < scorers[last].doc()) { // find doc w/ all clauses
62  66471