summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-05 05:52:57 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-05 05:52:57 +0000
commit7deec1481cb9ec381f147cf353bc4d4053871c6e (patch)
treeb24832d20c2e395ebbe1e9e9b85860dac9c8b856 /Tools/Source/MigrationTools
parentc8df018e44c9a88a582472339b645d4087848fd6 (diff)
downloadedk2-7deec1481cb9ec381f147cf353bc4d4053871c6e.zip
edk2-7deec1481cb9ec381f147cf353bc4d4053871c6e.tar.gz
edk2-7deec1481cb9ec381f147cf353bc4d4053871c6e.tar.bz2
enhance ForDoAll
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1451 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/MigrationTools')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/Common.java14
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/Critic.java2
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java10
3 files changed, 21 insertions, 5 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
index ca51ed4..19f64f7 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
@@ -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);
}
}
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java b/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
index b9f6242..95e95e9 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
@@ -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);
}
}
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
index 00dfe71..ffd1107 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
@@ -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;
+ }
}