]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Java/Source/MigrationTools/org/tianocore/migration/PathIterator.java
Coding Style
[mirror_edk2.git] / Tools / Java / Source / MigrationTools / org / tianocore / migration / PathIterator.java
CommitLineData
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 13package org.tianocore.migration;\r
14\r
71874f93 15import java.io.File;\r
71f30e51 16import java.util.HashSet;\r
17import java.util.Iterator;\r
5f4eb6b6 18\r
19public final class PathIterator implements Common.ForDoAll {\r
71f30e51 20 // this PathIterator is based on HashSet, an thread implementation is\r
21 // required.\r
22 PathIterator(String path, int md) throws Exception {\r
23 startpath = path;\r
24 mode = md;\r
25 Common.toDoAll(startpath, this, mode);\r
26 it = pathlist.iterator();\r
27 }\r
28\r
29 private String startpath = null;\r
30\r
31 private int mode;\r
32\r
33 private HashSet<String> pathlist = new HashSet<String>();\r
34\r
35 private Iterator<String> it = null;\r
36\r
37 public final void run(String path) throws Exception {\r
38 pathlist.add(path);\r
39 }\r
40\r
41 public boolean filter(File dir) {\r
42 return true;\r
43 }\r
44\r
45 public final String next() {\r
46 return it.next();\r
47 }\r
48\r
49 public final boolean hasNext() {\r
50 return it.hasNext();\r
51 }\r
52\r
53 public final String toString() {\r
54 return pathlist.toString();\r
55 }\r
5f4eb6b6 56}\r