summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
new file mode 100644
index 0000000..0207577
--- /dev/null
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
@@ -0,0 +1,33 @@
+package org.tianocore.migration;
+
+import java.util.*;
+
+public final class PathIterator implements Common.ForDoAll {
+// this PathIterator is based on HashSet, an thread implementation is required.
+ PathIterator(String path, int md) throws Exception {
+ startpath = path;
+ mode = md;
+ Common.toDoAll(startpath, this, mode);
+ it = pathlist.iterator();
+ }
+ private String startpath = null;
+ private int mode;
+ private HashSet<String> pathlist = new HashSet<String>();
+ private Iterator<String> it = null;
+
+ public final void toDo(String path) throws Exception {
+ pathlist.add(path);
+ }
+
+ public final String next() {
+ return it.next();
+ }
+
+ public final boolean hasNext() {
+ return it.hasNext();
+ }
+
+ public final String toString() {
+ return pathlist.toString();
+ }
+}