// for each sourcePath entry, add a directoryset with includes
// taken from packagenames attribute and nested package
// elements and excludes taken from excludepackages attribute
// and nested excludepackage elements
if (sourcePath != null) {
PatternSet ps = new PatternSet();
ps.setProject(getProject());
if (packageNames.size() > 0) {
Enumeration e = packageNames.elements();
while (e.hasMoreElements()) {
PackageName p = (PackageName) e.nextElement();
String pkg = p.getName().replace('.', '/');
if (pkg.endsWith("*")) {
pkg += "*";
}
ps.createInclude().setName(pkg);
}
} else {
ps.createInclude().setName("**");
}
Enumeration e = excludePackageNames.elements();
while (e.hasMoreElements()) {
PackageName p = (PackageName) e.nextElement();
String pkg = p.getName().replace('.', '/');
if (pkg.endsWith("*")) {
pkg += "*";
}
ps.createExclude().setName(pkg);
}
String[] pathElements = sourcePath.list();
for (int i = 0; i < pathElements.length; i++) {