]>
Commit | Line | Data |
---|---|---|
5f4eb6b6 | 1 | package org.tianocore.migration;\r |
2 | \r | |
3 | import java.util.*;\r | |
4 | \r | |
5 | public final class PathIterator implements Common.ForDoAll {\r | |
6 | // this PathIterator is based on HashSet, an thread implementation is required.\r | |
7 | PathIterator(String path, int md) throws Exception {\r | |
8 | startpath = path;\r | |
9 | mode = md;\r | |
10 | Common.toDoAll(startpath, this, mode);\r | |
11 | it = pathlist.iterator();\r | |
12 | }\r | |
13 | private String startpath = null;\r | |
14 | private int mode;\r | |
15 | private HashSet<String> pathlist = new HashSet<String>();\r | |
16 | private Iterator<String> it = null;\r | |
17 | \r | |
18 | public final void toDo(String path) throws Exception {\r | |
19 | pathlist.add(path);\r | |
20 | }\r | |
21 | \r | |
22 | public final String next() {\r | |
23 | return it.next();\r | |
24 | }\r | |
25 | \r | |
26 | public final boolean hasNext() {\r | |
27 | return it.hasNext();\r | |
28 | }\r | |
29 | \r | |
30 | public final String toString() {\r | |
31 | return pathlist.toString();\r | |
32 | }\r | |
33 | }\r |