Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart8.png 55% of files have more coverage
105   266   48   6.18
50   198   0.46   3.4
17     2.82  
5    
 
  BooleanScorer       Line # 21 79 40 73.5% 0.7352941
  BooleanScorer.SubScorer       Line # 36 6 1 100% 1.0
  BooleanScorer.Bucket       Line # 187 0 0 - -1.0
  BooleanScorer.BucketTable       Line # 196 3 3 66.7% 0.6666667
  BooleanScorer.Collector       Line # 216 17 4 100% 1.0
 
  (10)
 
<
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2004 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   
 
21    final class BooleanScorer extends Scorer {
22    private SubScorer scorers = null;
23    private BucketTable bucketTable = new BucketTable(this);
24   
25    private int maxCoord = 1;
26    private float[] coordFactors = null;
27   
28    private int requiredMask = 0;
29    private int prohibitedMask = 0;
30    private int nextMask = 1;
31   
 
32  1706 toggle BooleanScorer(Similarity similarity) {
33  1706 super(similarity);
34    }
35   
 
36    static final class SubScorer {
37    public Scorer scorer;
38    public boolean done;
39    public boolean required = false;
40    public boolean prohibited = false;
41    public HitCollector collector;
42    public SubScorer next;
43   
 
44  5980 toggle public SubScorer(Scorer scorer, boolean required, boolean prohibited,
45    HitCollector collector, SubScorer next)
46    throws IOException {
47  5980 this.scorer = scorer;
48  5980 this.done = !scorer.next();
49  5980 this.required = required;
50  5980 this.prohibited = prohibited;
51  5980 this.collector = collector;
52  5980 this.next = next;
53    }
54    }
55   
 
56  5980 toggle final void add(Scorer scorer, boolean required, boolean prohibited)
57    throws IOException {
58  5980 int mask = 0;
59  5980 if (required || prohibited) {
60  2953 if (nextMask == 0)
61  0 throw new IndexOutOfBoundsException
62    ("More than 32 required/prohibited clauses in query.");
63  2953 mask = nextMask;
64  2953 nextMask = nextMask << 1;
65    } else
66  3027 mask = 0;
67   
68  5980 if (!prohibited)
69  4774 maxCoord++;
70   
71  5980 if (prohibited)
72  1206 prohibitedMask |= mask; // update prohibited mask
73  4774 else if (required)
74  1747 requiredMask |= mask; // update required mask
75   
76  5980 scorers = new SubScorer(scorer, required, prohibited,
77    bucketTable.newCollector(mask), scorers);
78    }
79   
 
80  1354 toggle private final void computeCoordFactors() {
81  1354 coordFactors = new float[maxCoord];
82  6502 for (int i = 0; i < maxCoord; i++)
83  5148 coordFactors[i] = getSimilarity().coord(i, maxCoord-1);
84    }
85   
86    private int end;
87    private Bucket current;
88   
 
89  912 toggle public void score(HitCollector hc) throws IOException {
90  912 next();
91  912 score(hc, Integer.MAX_VALUE);
92    }
93   
 
94  912 toggle protected boolean score(HitCollector hc, int max) throws IOException {
95  912 if (coordFactors == null)
96  912 computeCoordFactors();
97   
98  912 boolean more;
99  912 Bucket tmp;
100   
101  912 do {
102  912 bucketTable.first = null;
103   
104  2756 while (current != null) { // more queued
105   
106    // check prohibited & required
107  1844 if ((current.bits & prohibitedMask) == 0 &&
108    (current.bits & requiredMask) == requiredMask) {
109   
110  1215 if (current.doc >= max){
111  0 tmp = current;
112