Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart9.png 37% of files have more coverage
39   156   24   1.95
8   106   0.62   6.67
20     1.2  
3    
 
  MatchAllDocsQuery       Line # 35 10 7 94.4% 0.9444444
  MatchAllDocsQuery.MatchAllScorer       Line # 40 15 8 92% 0.92
  MatchAllDocsQuery.MatchAllDocsWeight       Line # 84 14 9 83.3% 0.8333333
 
  (9)
 
1    package org.apache.lucene.search;
2   
3    /**
4    * Copyright 2005 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 org.apache.lucene.index.IndexReader;
20    import org.apache.lucene.search.Explanation;
21    import org.apache.lucene.search.Query;
22    import org.apache.lucene.search.Scorer;
23    import org.apache.lucene.search.Searcher;
24    import org.apache.lucene.search.Similarity;
25    import org.apache.lucene.search.Weight;
26    import org.apache.lucene.util.ToStringUtils;
27   
28    import java.util.Set;
29   
30    /**
31    * A query that matches all documents.
32    *
33    * @author John Wang
34    */
 
35    public class MatchAllDocsQuery extends Query {
36   
 
37  15 toggle public MatchAllDocsQuery() {
38    }
39   
 
40    private class MatchAllScorer extends Scorer {
41   
42    final IndexReader reader;
43    int id;
44    final int maxId;
45    final float score;
46   
 
47  25 toggle MatchAllScorer(IndexReader reader, Similarity similarity, Weight w) {
48  25 super(similarity);
49  25 this.reader = reader;
50  25 id = -1;
51  25 maxId = reader.maxDoc() - 1;
52  25 score = w.getValue();
53    }
54   
 
55  0 toggle public Explanation explain(int doc) {
56  0 return null; // not called... see MatchAllDocsWeight.explain()
57    }
58   
 
59  196 toggle public int doc() {
60  196 return id;
61    }
62   
 
63  109 toggle public boolean next() {
64  110 while (id < maxId) {
65  89 id++;
66  89 if (!reader.isDeleted(id)) {
67  88 return true;
68    }
69    }
70  21 return false;
71    }
72   
 
73  78 toggle public float score() {
74  78 return score;
75    }
76   
 
77  19 toggle public boolean skipTo(int target) {
78  19 id = target - 1;
79  19 return next();
80    }
81   
82    }
83   
 
84    private class MatchAllDocsWeight implements Weight {
85    private Similarity similarity;
86    private float queryWeight;
87    private float queryNorm;
88   
 
89  41 toggle public MatchAllDocsWeight(Searcher searcher) {
90  41 this.similarity = searcher.getSimilarity();
91    }
92   
 
93  0 toggle public String toString() {
94  0 return "weight(" + MatchAllDocsQuery.this + ")";
95    }
96   
 
97  0 toggle public Query getQuery() {
98  0 return MatchAllDocsQuery.this;
99    }
100   
 
101  41 toggle public float getValue() {
102