]> git.proxmox.com Git - mirror_edk2.git/commitdiff
enhance ForDoAll
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Sep 2006 05:52:57 +0000 (05:52 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 5 Sep 2006 05:52:57 +0000 (05:52 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1451 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/MigrationTools/org/tianocore/migration/Common.java
Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java

index ca51ed43adf4b4ea3bfa951300301a70f7340bf1..19f64f7e512ea5dc874bc73714e755eff8f8340b 100644 (file)
@@ -148,7 +148,9 @@ public final class Common {
                File test;\r
 \r
                if (type == DIR || type == BOTH) {\r
-                       fda.toDo(path);\r
+                       if (fda.dirFilter(path)) {\r
+                               fda.run(path);\r
+                       }\r
                }\r
                for (int i = 0 ; i < list.length ; i++) {\r
                        test = new File(path + File.separator + list[i]);\r
@@ -156,13 +158,19 @@ public final class Common {
                                toDoAll(path + File.separator + list[i], fda, type);\r
                        } else {\r
                                if (type == FILE || type == BOTH) {\r
-                                       fda.toDo(path + File.separator + list[i]);\r
+                                       if (fda.fileFilter(path + File.separator + list[i])) {\r
+                                               fda.run(path + File.separator + list[i]);\r
+                                       }\r
                                }\r
                        }\r
                }\r
        }\r
        \r
        public static interface ForDoAll {\r
-               public void toDo(String filepath) throws Exception;\r
+               public void run(String filepath) throws Exception;\r
+               \r
+               public boolean dirFilter(String filepath);\r
+               \r
+               public boolean fileFilter(String filepath);\r
        }\r
 }\r
index b9f62423526d9f10b91db93024b0041d6254f355..95e95e9dd4cd5b2a456be65442e0c39ad9ce467b 100644 (file)
@@ -27,7 +27,7 @@ public final class Critic {
        private static final int totallinelength = 82;\r
        \r
        public static final void run(String filepath) throws Exception {\r
-               if (MigrationTool.doCritic) {\r
+               if (MigrationTool.doCritic) {                                   // this is left here to set an example for future structure\r
                        critic(filepath);\r
                }\r
        }\r
index 00dfe719aa2090d883256acb24de71b70303dbe7..ffd11070672b124d8af64690cde405b4764a2c4e 100644 (file)
@@ -27,7 +27,7 @@ public final class PathIterator implements Common.ForDoAll {
        private HashSet<String> pathlist = new HashSet<String>();\r
        private Iterator<String> it = null;\r
 \r
-       public final void toDo(String path) throws Exception {\r
+       public final void run(String path) throws Exception {\r
                pathlist.add(path);\r
        }\r
 \r
@@ -42,4 +42,12 @@ public final class PathIterator implements Common.ForDoAll {
        public final String toString() {\r
                return pathlist.toString();\r
        }\r
+       \r
+       public boolean dirFilter(String filepath) {\r
+               return true;\r
+       }\r
+       \r
+       public boolean fileFilter(String filepath) {\r
+               return true;\r
+       }\r
 }\r