16
16
* limitations under the License.
17
17
*/
18
18
19
-
20
19
import java .io .File ;
21
20
import java .util .ArrayList ;
22
21
import java .util .List ;
@@ -30,7 +29,7 @@ public abstract class AbstractScanner
30
29
/**
31
30
* Patterns which should be excluded by default, like SCM files
32
31
* <ul>
33
- * <li>Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._* </li>
32
+ * <li>Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._*</li>
34
33
* <li>CVS: **/CVS, **/CVS/**, **/.cvsignore</li>
35
34
* <li>RCS: **/RCS, **/RCS/**</li>
36
35
* <li>SCCS: **/SCCS, **/SCCS/**</li>
@@ -44,8 +43,10 @@ public abstract class AbstractScanner
44
43
* <li>Serena Dimension: **/.metadata, **/.metadata/**</li>
45
44
* <li>Mercurial: **/.hg, **/.hg/**, **/.hgignore</li>
46
45
* <li>GIT: **/.git, **/.gitignore, **/.gitattributes, **/.git/**</li>
47
- * <li>Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet, **/ChangeSet/**</li>
48
- * <li>Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo, **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail
46
+ * <li>Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet,
47
+ * **/ChangeSet/**</li>
48
+ * <li>Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo,
49
+ * **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail
49
50
* </ul>
50
51
*
51
52
* @see #addDefaultExcludes()
@@ -75,10 +76,10 @@ public abstract class AbstractScanner
75
76
// Arch
76
77
"**/.arch-ids" , "**/.arch-ids/**" ,
77
78
78
- //Bazaar
79
+ // Bazaar
79
80
"**/.bzr" , "**/.bzr/**" ,
80
81
81
- //SurroundSCM
82
+ // SurroundSCM
82
83
"**/.MySCMServerInfo" ,
83
84
84
85
// Mac
@@ -114,58 +115,45 @@ public abstract class AbstractScanner
114
115
private MatchPatterns excludesPatterns ;
115
116
116
117
/**
117
- * Whether or not the file system should be treated as a case sensitive
118
- * one.
118
+ * Whether or not the file system should be treated as a case sensitive one.
119
119
*/
120
120
protected boolean isCaseSensitive = true ;
121
121
122
122
/**
123
123
* Sets whether or not the file system should be regarded as case sensitive.
124
124
*
125
- * @param isCaseSensitive whether or not the file system should be
126
- * regarded as a case sensitive one
125
+ * @param isCaseSensitive whether or not the file system should be regarded as a case sensitive one
127
126
*/
128
127
public void setCaseSensitive ( boolean isCaseSensitive )
129
128
{
130
129
this .isCaseSensitive = isCaseSensitive ;
131
130
}
132
131
133
132
/**
134
- * Tests whether or not a given path matches the start of a given
135
- * pattern up to the first "**".
133
+ * Tests whether or not a given path matches the start of a given pattern up to the first "**".
136
134
* <p/>
137
- * This is not a general purpose test and should only be used if you
138
- * can live with false positives. For example, <code>pattern=**\a</code>
139
- * and <code>str=b</code> will yield <code>true</code>.
135
+ * This is not a general purpose test and should only be used if you can live with false positives. For example,
136
+ * <code>pattern=**\a</code> and <code>str=b</code> will yield <code>true</code>.
140
137
*
141
- * @param pattern The pattern to match against. Must not be
142
- * <code>null</code>.
143
- * @param str The path to match, as a String. Must not be
144
- * <code>null</code>.
145
- * @return whether or not a given path matches the start of a given
146
- * pattern up to the first "**".
138
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
139
+ * @param str The path to match, as a String. Must not be <code>null</code>.
140
+ * @return whether or not a given path matches the start of a given pattern up to the first "**".
147
141
*/
148
142
protected static boolean matchPatternStart ( String pattern , String str )
149
143
{
150
144
return SelectorUtils .matchPatternStart ( pattern , str );
151
145
}
152
146
153
147
/**
154
- * Tests whether or not a given path matches the start of a given
155
- * pattern up to the first "**".
148
+ * Tests whether or not a given path matches the start of a given pattern up to the first "**".
156
149
* <p/>
157
- * This is not a general purpose test and should only be used if you
158
- * can live with false positives. For example, <code>pattern=**\a</code>
159
- * and <code>str=b</code> will yield <code>true</code>.
150
+ * This is not a general purpose test and should only be used if you can live with false positives. For example,
151
+ * <code>pattern=**\a</code> and <code>str=b</code> will yield <code>true</code>.
160
152
*
161
- * @param pattern The pattern to match against. Must not be
162
- * <code>null</code>.
163
- * @param str The path to match, as a String. Must not be
164
- * <code>null</code>.
165
- * @param isCaseSensitive Whether or not matching should be performed
166
- * case sensitively.
167
- * @return whether or not a given path matches the start of a given
168
- * pattern up to the first "**".
153
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
154
+ * @param str The path to match, as a String. Must not be <code>null</code>.
155
+ * @param isCaseSensitive Whether or not matching should be performed case sensitively.
156
+ * @return whether or not a given path matches the start of a given pattern up to the first "**".
169
157
*/
170
158
protected static boolean matchPatternStart ( String pattern , String str , boolean isCaseSensitive )
171
159
{
@@ -175,12 +163,9 @@ protected static boolean matchPatternStart( String pattern, String str, boolean
175
163
/**
176
164
* Tests whether or not a given path matches a given pattern.
177
165
*
178
- * @param pattern The pattern to match against. Must not be
179
- * <code>null</code>.
180
- * @param str The path to match, as a String. Must not be
181
- * <code>null</code>.
182
- * @return <code>true</code> if the pattern matches against the string,
183
- * or <code>false</code> otherwise.
166
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
167
+ * @param str The path to match, as a String. Must not be <code>null</code>.
168
+ * @return <code>true</code> if the pattern matches against the string, or <code>false</code> otherwise.
184
169
*/
185
170
protected static boolean matchPath ( String pattern , String str )
186
171
{
@@ -190,71 +175,53 @@ protected static boolean matchPath( String pattern, String str )
190
175
/**
191
176
* Tests whether or not a given path matches a given pattern.
192
177
*
193
- * @param pattern The pattern to match against. Must not be
194
- * <code>null</code>.
195
- * @param str The path to match, as a String. Must not be
196
- * <code>null</code>.
197
- * @param isCaseSensitive Whether or not matching should be performed
198
- * case sensitively.
199
- * @return <code>true</code> if the pattern matches against the string,
200
- * or <code>false</code> otherwise.
178
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
179
+ * @param str The path to match, as a String. Must not be <code>null</code>.
180
+ * @param isCaseSensitive Whether or not matching should be performed case sensitively.
181
+ * @return <code>true</code> if the pattern matches against the string, or <code>false</code> otherwise.
201
182
*/
202
183
protected static boolean matchPath ( String pattern , String str , boolean isCaseSensitive )
203
184
{
204
185
return SelectorUtils .matchPath ( pattern , str , isCaseSensitive );
205
186
}
206
187
207
188
/**
208
- * Tests whether or not a string matches against a pattern.
209
- * The pattern may contain two special characters:<br>
189
+ * Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br>
210
190
* '*' means zero or more characters<br>
211
191
* '?' means one and only one character
212
192
*
213
- * @param pattern The pattern to match against.
214
- * Must not be <code>null</code>.
215
- * @param str The string which must be matched against the pattern.
216
- * Must not be <code>null</code>.
217
- * @return <code>true</code> if the string matches against the pattern,
218
- * or <code>false</code> otherwise.
193
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
194
+ * @param str The string which must be matched against the pattern. Must not be <code>null</code>.
195
+ * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
219
196
*/
220
197
public static boolean match ( String pattern , String str )
221
198
{
222
199
return SelectorUtils .match ( pattern , str );
223
200
}
224
201
225
202
/**
226
- * Tests whether or not a string matches against a pattern.
227
- * The pattern may contain two special characters:<br>
203
+ * Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br>
228
204
* '*' means zero or more characters<br>
229
205
* '?' means one and only one character
230
206
*
231
- * @param pattern The pattern to match against.
232
- * Must not be <code>null</code>.
233
- * @param str The string which must be matched against the pattern.
234
- * Must not be <code>null</code>.
235
- * @param isCaseSensitive Whether or not matching should be performed
236
- * case sensitively.
237
- * @return <code>true</code> if the string matches against the pattern,
238
- * or <code>false</code> otherwise.
207
+ * @param pattern The pattern to match against. Must not be <code>null</code>.
208
+ * @param str The string which must be matched against the pattern. Must not be <code>null</code>.
209
+ * @param isCaseSensitive Whether or not matching should be performed case sensitively.
210
+ * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
239
211
*/
240
212
protected static boolean match ( String pattern , String str , boolean isCaseSensitive )
241
213
{
242
214
return SelectorUtils .match ( pattern , str , isCaseSensitive );
243
215
}
244
216
245
-
246
217
/**
247
- * Sets the list of include patterns to use. All '/' and '\' characters
248
- * are replaced by <code>File.separatorChar</code>, so the separator used
249
- * need not match <code>File.separatorChar</code>.
218
+ * Sets the list of include patterns to use. All '/' and '\' characters are replaced by
219
+ * <code>File.separatorChar</code>, so the separator used need not match <code>File.separatorChar</code>.
250
220
* <p/>
251
221
* When a pattern ends with a '/' or '\', "**" is appended.
252
222
*
253
- * @param includes A list of include patterns.
254
- * May be <code>null</code>, indicating that all files
255
- * should be included. If a non-<code>null</code>
256
- * list is given, all elements must be
257
- * non-<code>null</code>.
223
+ * @param includes A list of include patterns. May be <code>null</code>, indicating that all files should be
224
+ * included. If a non-<code>null</code> list is given, all elements must be non-<code>null</code>.
258
225
*/
259
226
public void setIncludes ( String [] includes )
260
227
{
@@ -272,21 +239,18 @@ public void setIncludes( String[] includes )
272
239
list .add ( normalizePattern ( include ) );
273
240
}
274
241
}
275
- this .includes = list .toArray ( new String [ list .size () ] );
242
+ this .includes = list .toArray ( new String [list .size ()] );
276
243
}
277
244
}
278
245
279
246
/**
280
- * Sets the list of exclude patterns to use. All '/' and '\' characters
281
- * are replaced by <code>File.separatorChar</code>, so the separator used
282
- * need not match <code>File.separatorChar</code>.
247
+ * Sets the list of exclude patterns to use. All '/' and '\' characters are replaced by
248
+ * <code>File.separatorChar</code>, so the separator used need not match <code>File.separatorChar</code>.
283
249
* <p/>
284
250
* When a pattern ends with a '/' or '\', "**" is appended.
285
251
*
286
- * @param excludes A list of exclude patterns.
287
- * May be <code>null</code>, indicating that no files
288
- * should be excluded. If a non-<code>null</code> list is
289
- * given, all elements must be non-<code>null</code>.
252
+ * @param excludes A list of exclude patterns. May be <code>null</code>, indicating that no files should be
253
+ * excluded. If a non-<code>null</code> list is given, all elements must be non-<code>null</code>.
290
254
*/
291
255
public void setExcludes ( String [] excludes )
292
256
{
@@ -304,7 +268,7 @@ public void setExcludes( String[] excludes )
304
268
list .add ( normalizePattern ( exclude ) );
305
269
}
306
270
}
307
- this .excludes = list .toArray ( new String [ list .size () ] );
271
+ this .excludes = list .toArray ( new String [list .size ()] );
308
272
}
309
273
}
310
274
@@ -343,12 +307,11 @@ private String normalizePattern( String pattern )
343
307
}
344
308
345
309
/**
346
- * Tests whether or not a name matches against at least one include
347
- * pattern.
310
+ * Tests whether or not a name matches against at least one include pattern.
348
311
*
349
312
* @param name The name to match. Must not be <code>null</code>.
350
- * @return <code>true</code> when the name matches against at least one
351
- * include pattern, or <code>false</code> otherwise.
313
+ * @return <code>true</code> when the name matches against at least one include pattern, or <code>false</code>
314
+ * otherwise.
352
315
*/
353
316
protected boolean isIncluded ( String name )
354
317
{
@@ -361,25 +324,23 @@ protected boolean isIncluded( String name, String[] tokenizedName )
361
324
}
362
325
363
326
/**
364
- * Tests whether or not a name matches the start of at least one include
365
- * pattern.
327
+ * Tests whether or not a name matches the start of at least one include pattern.
366
328
*
367
329
* @param name The name to match. Must not be <code>null</code>.
368
- * @return <code>true</code> when the name matches against the start of at
369
- * least one include pattern, or <code>false</code> otherwise.
330
+ * @return <code>true</code> when the name matches against the start of at least one include pattern, or
331
+ * <code>false</code> otherwise.
370
332
*/
371
333
protected boolean couldHoldIncluded ( String name )
372
334
{
373
- return includesPatterns .matchesPatternStart (name , isCaseSensitive );
335
+ return includesPatterns .matchesPatternStart ( name , isCaseSensitive );
374
336
}
375
337
376
338
/**
377
- * Tests whether or not a name matches against at least one exclude
378
- * pattern.
339
+ * Tests whether or not a name matches against at least one exclude pattern.
379
340
*
380
341
* @param name The name to match. Must not be <code>null</code>.
381
- * @return <code>true</code> when the name matches against at least one
382
- * exclude pattern, or <code>false</code> otherwise.
342
+ * @return <code>true</code> when the name matches against at least one exclude pattern, or <code>false</code>
343
+ * otherwise.
383
344
*/
384
345
protected boolean isExcluded ( String name )
385
346
{
0 commit comments