Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
14   51   7   7
10   28   0.5   2
2     3.5  
1    
 
  ExactPhraseScorer       Line # 22 14 7 96.2% 0.96153843
 
  (23)
 
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    import org.apache.lucene.index.*;
21   
 
22    final class ExactPhraseScorer extends PhraseScorer {
23   
 
24  99 toggle ExactPhraseScorer(Weight weight, TermPositions[] tps, int[] positions, Similarity similarity,
25    byte[] norms) {
26  99 super(weight, tps, positions, similarity, norms);
27    }
28   
 
29  328 toggle protected final float phraseFreq() throws IOException {
30    // sort list with pq
31  984 for (PhrasePositions pp = first; pp != null; pp = pp.next) {
32  656 pp.firstPosition();
33  656 pq.put(pp); // build pq from list
34    }
35  328 pqToList(); // rebuild list from pq
36   
37  328 int freq = 0;
38  328 do { // find position w/ all terms
39  383 while (first.position < last.position) { // scan forward in first
40  170 do {
41  170 if (!first.nextPosition())
42  153 return (float)freq;
43  17 } while (first.position < last.position);
44  17 firstToLast();
45    }
46  213 freq++; // all equal: a match
47  213 } while (last.nextPosition());
48   
49  175 return (float)freq;
50    }
51    }