public abstract class AbstractScanner extends Object implements Scanner
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULTEXCLUDES
Patterns which should be excluded by default, like SCM files
Misc: **/*~, **/#*#, **/.#*, **/%*%, **/._*
CVS: **/CVS, **/CVS/**, **/.cvsignore
RCS: **/RCS, **/RCS/**
SCCS: **/SCCS, **/SCCS/**
VSSercer: **/vssver.scc
MKS: **/project.pj
SVN: **/.svn, **/.svn/**
GNU: **/.arch-ids, **/.arch-ids/**
Bazaar: **/.bzr, **/.bzr/**
SurroundSCM: **/.MySCMServerInfo
Mac: **/.DS_Store
Serena Dimension: **/.metadata, **/.metadata/**
Mercurial: **/.hg, **/.hg/**
GIT: **/.git, **/.gitignore, **/.gitattributes, **/.git/**
Bitkeeper: **/BitKeeper, **/BitKeeper/**, **/ChangeSet, **/ChangeSet/**
Darcs: **/_darcs, **/_darcs/**, **/.darcsrepo, **/.darcsrepo/****/-darcs-backup*, **/.darcs-temp-mail
|
protected String[] |
excludes
The patterns for the files to be excluded.
|
protected String[] |
includes
The patterns for the files to be included.
|
protected boolean |
isCaseSensitive
Whether or not the file system should be treated as a case sensitive
one.
|
Constructor and Description |
---|
AbstractScanner() |
Modifier and Type | Method and Description |
---|---|
void |
addDefaultExcludes()
Adds default exclusions to the current exclusions set.
|
protected boolean |
couldHoldIncluded(String name)
Tests whether or not a name matches the start of at least one include
pattern.
|
protected boolean |
isExcluded(String name)
Tests whether or not a name matches against at least one exclude
pattern.
|
protected boolean |
isExcluded(String name,
String[] tokenizedName) |
protected boolean |
isIncluded(String name)
Tests whether or not a name matches against at least one include
pattern.
|
protected boolean |
isIncluded(String name,
String[] tokenizedName) |
static boolean |
match(String pattern,
String str)
Tests whether or not a string matches against a pattern.
|
protected static boolean |
match(String pattern,
String str,
boolean isCaseSensitive)
Tests whether or not a string matches against a pattern.
|
protected static boolean |
matchPath(String pattern,
String str)
Tests whether or not a given path matches a given pattern.
|
protected static boolean |
matchPath(String pattern,
String str,
boolean isCaseSensitive)
Tests whether or not a given path matches a given pattern.
|
protected static boolean |
matchPatternStart(String pattern,
String str)
Tests whether or not a given path matches the start of a given
pattern up to the first "**".
|
protected static boolean |
matchPatternStart(String pattern,
String str,
boolean isCaseSensitive)
Tests whether or not a given path matches the start of a given
pattern up to the first "**".
|
void |
setCaseSensitive(boolean isCaseSensitive)
Sets whether or not the file system should be regarded as case sensitive.
|
void |
setExcludes(String[] excludes)
Sets the list of exclude patterns to use.
|
void |
setIncludes(String[] includes)
Sets the list of include patterns to use.
|
protected void |
setupDefaultFilters() |
protected void |
setupMatchPatterns() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBasedir, getIncludedDirectories, getIncludedFiles, scan
public static final String[] DEFAULTEXCLUDES
addDefaultExcludes()
protected String[] includes
protected String[] excludes
protected boolean isCaseSensitive
public void setCaseSensitive(boolean isCaseSensitive)
isCaseSensitive
- whether or not the file system should be
regarded as a case sensitive oneprotected static boolean matchPatternStart(String pattern, String str)
pattern=**\a
and str=b
will yield true
.pattern
- The pattern to match against. Must not be
null
.str
- The path to match, as a String. Must not be
null
.protected static boolean matchPatternStart(String pattern, String str, boolean isCaseSensitive)
pattern=**\a
and str=b
will yield true
.pattern
- The pattern to match against. Must not be
null
.str
- The path to match, as a String. Must not be
null
.isCaseSensitive
- Whether or not matching should be performed
case sensitively.protected static boolean matchPath(String pattern, String str)
pattern
- The pattern to match against. Must not be
null
.str
- The path to match, as a String. Must not be
null
.true
if the pattern matches against the string,
or false
otherwise.protected static boolean matchPath(String pattern, String str, boolean isCaseSensitive)
pattern
- The pattern to match against. Must not be
null
.str
- The path to match, as a String. Must not be
null
.isCaseSensitive
- Whether or not matching should be performed
case sensitively.true
if the pattern matches against the string,
or false
otherwise.public static boolean match(String pattern, String str)
pattern
- The pattern to match against.
Must not be null
.str
- The string which must be matched against the pattern.
Must not be null
.true
if the string matches against the pattern,
or false
otherwise.protected static boolean match(String pattern, String str, boolean isCaseSensitive)
pattern
- The pattern to match against.
Must not be null
.str
- The string which must be matched against the pattern.
Must not be null
.isCaseSensitive
- Whether or not matching should be performed
case sensitively.true
if the string matches against the pattern,
or false
otherwise.public void setIncludes(String[] includes)
File.separatorChar
, so the separator used
need not match File.separatorChar
.
When a pattern ends with a '/' or '\', "**" is appended.setIncludes
in interface Scanner
includes
- A list of include patterns.
May be null
, indicating that all files
should be included. If a non-null
list is given, all elements must be
non-null
.public void setExcludes(String[] excludes)
File.separatorChar
, so the separator used
need not match File.separatorChar
.
When a pattern ends with a '/' or '\', "**" is appended.setExcludes
in interface Scanner
excludes
- A list of exclude patterns.
May be null
, indicating that no files
should be excluded. If a non-null
list is
given, all elements must be non-null
.protected boolean isIncluded(String name)
name
- The name to match. Must not be null
.true
when the name matches against at least one
include pattern, or false
otherwise.protected boolean couldHoldIncluded(String name)
name
- The name to match. Must not be null
.true
when the name matches against the start of at
least one include pattern, or false
otherwise.protected boolean isExcluded(String name)
name
- The name to match. Must not be null
.true
when the name matches against at least one
exclude pattern, or false
otherwise.public void addDefaultExcludes()
addDefaultExcludes
in interface Scanner
protected void setupDefaultFilters()
protected void setupMatchPatterns()
Copyright © 2001-2014 Codehaus. All Rights Reserved.