Clover Coverage Report
Coverage timestamp: Fri May 9 2008 10:54:27 EST
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
18   115   10   2.57
10   44   0.56   7
7     1.43  
1    
 
  StopFilter       Line # 27 18 10 100% 1.0
 
  (44)
 
1    package org.apache.lucene.analysis;
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 java.util.HashSet;
21    import java.util.Set;
22   
23    /**
24    * Removes stop words from a token stream.
25    */
26   
 
27    public final class StopFilter extends TokenFilter {
28   
29    private final Set stopWords;
30    private final boolean ignoreCase;
31   
32    /**
33    * Construct a token stream filtering the given input.
34    */
 
35  1 toggle public StopFilter(TokenStream input, String [] stopWords)
36    {
37  1 this(input, stopWords, false);
38    }
39   
40    /**
41    * Constructs a filter which removes words from the input
42    * TokenStream that are named in the array of words.
43    */
 
44  2 toggle public StopFilter(TokenStream in, String[] stopWords, boolean ignoreCase) {
45  2 super(in);
46  2 this.ignoreCase = ignoreCase;
47  2 this.stopWords = makeStopSet(stopWords, ignoreCase);
48    }
49   
50   
51    /**
52    * Construct a token stream filtering the given input.
53    * @param input
54    * @param stopWords The set of Stop Words, as Strings. If ignoreCase is true, all strings should be lower cased
55    * @param ignoreCase -Ignore case when stopping. The stopWords set must be setup to contain only lower case words
56    */
 
57  6522 toggle public StopFilter(TokenStream input, Set stopWords, boolean ignoreCase)
58    {
59  6522 super(input);
60  6522 this.ignoreCase = ignoreCase;
61  6522 this.stopWords = stopWords;
62    }
63   
64    /**
65    * Constructs a filter which removes words from the input
66    * TokenStream that are named in the Set.
67    * It is crucial that an efficient Set implementation is used
68    * for maximum performance.
69    *
70    * @see #makeStopSet(java.lang.String[])
71    */