]>
Commit | Line | Data |
---|---|---|
5ad6d22a | 1 | /** @file\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | **/\r | |
5f4eb6b6 | 13 | package org.tianocore.migration;\r |
14 | \r | |
71874f93 | 15 | import java.io.File;\r |
5f4eb6b6 | 16 | import java.util.*;\r |
17 | \r | |
18 | public final class PathIterator implements Common.ForDoAll {\r | |
27e0221a | 19 | // this PathIterator is based on HashSet, an thread implementation is required.\r |
20 | PathIterator(String path, int md) throws Exception {\r | |
21 | startpath = path;\r | |
22 | mode = md;\r | |
23 | Common.toDoAll(startpath, this, mode);\r | |
24 | it = pathlist.iterator();\r | |
25 | }\r | |
26 | private String startpath = null;\r | |
27 | private int mode;\r | |
28 | private HashSet<String> pathlist = new HashSet<String>();\r | |
29 | private Iterator<String> it = null;\r | |
5f4eb6b6 | 30 | \r |
27e0221a | 31 | public final void run(String path) throws Exception {\r |
32 | pathlist.add(path);\r | |
33 | }\r | |
5f4eb6b6 | 34 | \r |
27e0221a | 35 | public boolean filter(File dir) {\r |
36 | return true;\r | |
37 | }\r | |
38 | \r | |
39 | public final String next() {\r | |
40 | return it.next();\r | |
41 | }\r | |
5f4eb6b6 | 42 | \r |
27e0221a | 43 | public final boolean hasNext() {\r |
44 | return it.hasNext();\r | |
45 | }\r | |
5f4eb6b6 | 46 | \r |
27e0221a | 47 | public final String toString() {\r |
48 | return pathlist.toString();\r | |
49 | }\r | |
5f4eb6b6 | 50 | }\r |