mirror of https://github.com/acidanthera/audk.git
enhance ForDoAll
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1451 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c8df018e44
commit
7deec1481c
|
@ -148,7 +148,9 @@ public final class Common {
|
|||
File test;
|
||||
|
||||
if (type == DIR || type == BOTH) {
|
||||
fda.toDo(path);
|
||||
if (fda.dirFilter(path)) {
|
||||
fda.run(path);
|
||||
}
|
||||
}
|
||||
for (int i = 0 ; i < list.length ; i++) {
|
||||
test = new File(path + File.separator + list[i]);
|
||||
|
@ -156,13 +158,19 @@ public final class Common {
|
|||
toDoAll(path + File.separator + list[i], fda, type);
|
||||
} else {
|
||||
if (type == FILE || type == BOTH) {
|
||||
fda.toDo(path + File.separator + list[i]);
|
||||
if (fda.fileFilter(path + File.separator + list[i])) {
|
||||
fda.run(path + File.separator + list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static interface ForDoAll {
|
||||
public void toDo(String filepath) throws Exception;
|
||||
public void run(String filepath) throws Exception;
|
||||
|
||||
public boolean dirFilter(String filepath);
|
||||
|
||||
public boolean fileFilter(String filepath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class Critic {
|
|||
private static final int totallinelength = 82;
|
||||
|
||||
public static final void run(String filepath) throws Exception {
|
||||
if (MigrationTool.doCritic) {
|
||||
if (MigrationTool.doCritic) { // this is left here to set an example for future structure
|
||||
critic(filepath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class PathIterator implements Common.ForDoAll {
|
|||
private HashSet<String> pathlist = new HashSet<String>();
|
||||
private Iterator<String> it = null;
|
||||
|
||||
public final void toDo(String path) throws Exception {
|
||||
public final void run(String path) throws Exception {
|
||||
pathlist.add(path);
|
||||
}
|
||||
|
||||
|
@ -42,4 +42,12 @@ public final class PathIterator implements Common.ForDoAll {
|
|||
public final String toString() {
|
||||
return pathlist.toString();
|
||||
}
|
||||
|
||||
public boolean dirFilter(String filepath) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean fileFilter(String filepath) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue