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