Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../../img/srcFileCovDistChart9.png 37% of files have more coverage
47   136   25   2.76
16   84   0.53   17
17     1.47  
1    
 
  SpanFirstQuery       Line # 29 47 25 81.2% 0.8125
 
  (32)
 
1    package org.apache.lucene.search.spans;
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    import java.util.Collection;
22    import java.util.Set;
23   
24    import org.apache.lucene.index.IndexReader;
25    import org.apache.lucene.search.Query;
26    import org.apache.lucene.util.ToStringUtils;
27   
28    /** Matches spans near the beginning of a field. */
 
29    public class SpanFirstQuery extends SpanQuery {
30    private SpanQuery match;
31    private int end;
32   
33    /** Construct a SpanFirstQuery matching spans in <code>match</code> whose end
34    * position is less than or equal to <code>end</code>. */
 
35  33 toggle public SpanFirstQuery(SpanQuery match, int end) {
36  33 this.match = match;
37  33 this.end = end;
38    }
39   
40    /** Return the SpanQuery whose matches are filtered. */
 
41  0 toggle public SpanQuery getMatch() { return match; }
42   
43    /** Return the maximum end position permitted in a match. */
 
44  0 toggle public int getEnd() { return end; }
45   
 
46  237 toggle public String getField() { return match.getField(); }
47   
48    /** Returns a collection of all terms matched by this query.
49    * @deprecated use extractTerms instead
50    * @see #extractTerms(Set)
51    */
 
52  0 toggle public Collection getTerms() { return match.getTerms(); }
53   
 
54  296 toggle public String toString(String field) {
55  296 StringBuffer buffer = new StringBuffer();
56  296 buffer.append("spanFirst(");
57  296 buffer.append(match.toString(field));
58  296 buffer.append(", ");
59  296 buffer.append(end);
60  296 buffer.append(")");
61  296 buffer.append(ToStringUtils.boost(getBoost()));
62  296 return buffer.toString();
63    }
64   
 
65