Methods Summary |
---|
public void | addConfiguredPatternset(org.apache.tools.ant.types.PatternSet p)This is a patternset nested element.
if (isReference()) {
throw noChildrenAllowed();
}
String[] nestedIncludes = p.getIncludePatterns(getProject());
String[] nestedExcludes = p.getExcludePatterns(getProject());
if (nestedIncludes != null) {
for (int i = 0; i < nestedIncludes.length; i++) {
createInclude().setName(nestedIncludes[i]);
}
}
if (nestedExcludes != null) {
for (int i = 0; i < nestedExcludes.length; i++) {
createExclude().setName(nestedExcludes[i]);
}
}
|
private org.apache.tools.ant.types.PatternSet$NameEntry | addPatternToList(java.util.Vector list)add a name entry to the given list
NameEntry result = new NameEntry();
list.addElement(result);
return result;
|
public void | append(org.apache.tools.ant.types.PatternSet other, org.apache.tools.ant.Project p)Adds the patterns of the other instance to this set.
if (isReference()) {
throw new BuildException("Cannot append to a reference");
}
String[] incl = other.getIncludePatterns(p);
if (incl != null) {
for (int i = 0; i < incl.length; i++) {
createInclude().setName(incl[i]);
}
}
String[] excl = other.getExcludePatterns(p);
if (excl != null) {
for (int i = 0; i < excl.length; i++) {
createExclude().setName(excl[i]);
}
}
|
public java.lang.Object | clone()
try {
PatternSet ps = (PatternSet) super.clone();
ps.includeList = (Vector) includeList.clone();
ps.excludeList = (Vector) excludeList.clone();
ps.includesFileList = (Vector) includesFileList.clone();
ps.excludesFileList = (Vector) excludesFileList.clone();
return ps;
} catch (CloneNotSupportedException e) {
throw new BuildException(e);
}
|
public org.apache.tools.ant.types.PatternSet$NameEntry | createExclude()add a name entry on the exclude list
if (isReference()) {
throw noChildrenAllowed();
}
return addPatternToList(excludeList);
|
public org.apache.tools.ant.types.PatternSet$NameEntry | createExcludesFile()add a name entry on the exclude files list
if (isReference()) {
throw noChildrenAllowed();
}
return addPatternToList(excludesFileList);
|
public org.apache.tools.ant.types.PatternSet$NameEntry | createInclude()add a name entry on the include list
if (isReference()) {
throw noChildrenAllowed();
}
return addPatternToList(includeList);
|
public org.apache.tools.ant.types.PatternSet$NameEntry | createIncludesFile()add a name entry on the include files list
if (isReference()) {
throw noChildrenAllowed();
}
return addPatternToList(includesFileList);
|
public java.lang.String[] | getExcludePatterns(org.apache.tools.ant.Project p)Returns the filtered include patterns.
if (isReference()) {
return getRef(p).getExcludePatterns(p);
} else {
readFiles(p);
return makeArray(excludeList, p);
}
|
public java.lang.String[] | getIncludePatterns(org.apache.tools.ant.Project p)Returns the filtered include patterns.
if (isReference()) {
return getRef(p).getIncludePatterns(p);
} else {
readFiles(p);
return makeArray(includeList, p);
}
|
private org.apache.tools.ant.types.PatternSet | getRef(org.apache.tools.ant.Project p)Performs the check for circular references and returns the
referenced PatternSet.
return (PatternSet) getCheckedRef(p);
|
public boolean | hasPatterns(org.apache.tools.ant.Project p)Helper for FileSet classes.
Check if there are patterns defined.
if (isReference()) {
return getRef(p).hasPatterns(p);
} else {
return includesFileList.size() > 0 || excludesFileList.size() > 0
|| includeList.size() > 0 || excludeList.size() > 0;
}
|
private java.lang.String[] | makeArray(java.util.Vector list, org.apache.tools.ant.Project p)Convert a vector of NameEntry elements into an array of Strings.
if (list.size() == 0) {
return null;
}
Vector tmpNames = new Vector();
for (Enumeration e = list.elements(); e.hasMoreElements();) {
NameEntry ne = (NameEntry) e.nextElement();
String pattern = ne.evalName(p);
if (pattern != null && pattern.length() > 0) {
tmpNames.addElement(pattern);
}
}
String[] result = new String[tmpNames.size()];
tmpNames.copyInto(result);
return result;
|
private void | readFiles(org.apache.tools.ant.Project p)Read includesfile ot excludesfile if not already done so.
if (includesFileList.size() > 0) {
Enumeration e = includesFileList.elements();
while (e.hasMoreElements()) {
NameEntry ne = (NameEntry) e.nextElement();
String fileName = ne.evalName(p);
if (fileName != null) {
File inclFile = p.resolveFile(fileName);
if (!inclFile.exists()) {
throw new BuildException("Includesfile "
+ inclFile.getAbsolutePath()
+ " not found.");
}
readPatterns(inclFile, includeList, p);
}
}
includesFileList.removeAllElements();
}
if (excludesFileList.size() > 0) {
Enumeration e = excludesFileList.elements();
while (e.hasMoreElements()) {
NameEntry ne = (NameEntry) e.nextElement();
String fileName = ne.evalName(p);
if (fileName != null) {
File exclFile = p.resolveFile(fileName);
if (!exclFile.exists()) {
throw new BuildException("Excludesfile "
+ exclFile.getAbsolutePath()
+ " not found.");
}
readPatterns(exclFile, excludeList, p);
}
}
excludesFileList.removeAllElements();
}
|
private void | readPatterns(java.io.File patternfile, java.util.Vector patternlist, org.apache.tools.ant.Project p)Reads path matching patterns from a file and adds them to the
includes or excludes list (as appropriate).
BufferedReader patternReader = null;
try {
// Get a FileReader
patternReader =
new BufferedReader(new FileReader(patternfile));
// Create one NameEntry in the appropriate pattern list for each
// line in the file.
String line = patternReader.readLine();
while (line != null) {
if (line.length() > 0) {
line = p.replaceProperties(line);
addPatternToList(patternlist).setName(line);
}
line = patternReader.readLine();
}
} catch (IOException ioe) {
String msg = "An error occurred while reading from pattern file: "
+ patternfile;
throw new BuildException(msg, ioe);
} finally {
if (null != patternReader) {
try {
patternReader.close();
} catch (IOException ioe) {
//Ignore exception
}
}
}
|
public void | setExcludes(java.lang.String excludes)Appends excludes to the current list of exclude patterns.
Patterns may be separated by a comma or a space.
if (isReference()) {
throw tooManyAttributes();
}
if (excludes != null && excludes.length() > 0) {
StringTokenizer tok = new StringTokenizer(excludes, ", ", false);
while (tok.hasMoreTokens()) {
createExclude().setName(tok.nextToken());
}
}
|
public void | setExcludesfile(java.io.File excludesFile)Sets the name of the file containing the excludes patterns.
if (isReference()) {
throw tooManyAttributes();
}
createExcludesFile().setName(excludesFile.getAbsolutePath());
|
public void | setIncludes(java.lang.String includes)Appends includes to the current list of include patterns.
Patterns may be separated by a comma or a space.
if (isReference()) {
throw tooManyAttributes();
}
if (includes != null && includes.length() > 0) {
StringTokenizer tok = new StringTokenizer(includes, ", ", false);
while (tok.hasMoreTokens()) {
createInclude().setName(tok.nextToken());
}
}
|
public void | setIncludesfile(java.io.File includesFile)Sets the name of the file containing the includes patterns.
if (isReference()) {
throw tooManyAttributes();
}
createIncludesFile().setName(includesFile.getAbsolutePath());
|
public void | setRefid(Reference r)Makes this instance in effect a reference to another PatternSet
instance.
You must not set another attribute or nest elements inside
this element if you make it a reference.
if (!includeList.isEmpty() || !excludeList.isEmpty()) {
throw tooManyAttributes();
}
super.setRefid(r);
|
public java.lang.String | toString()
return "patternSet{ includes: " + includeList
+ " excludes: " + excludeList + " }";
|