]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
00dfe719aa2090d883256acb24de71b70303dbe7
[mirror_edk2.git] / Tools / 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.util.*;
16
17 public final class PathIterator implements Common.ForDoAll {
18 // this PathIterator is based on HashSet, an thread implementation is required.
19 PathIterator(String path, int md) throws Exception {
20 startpath = path;
21 mode = md;
22 Common.toDoAll(startpath, this, mode);
23 it = pathlist.iterator();
24 }
25 private String startpath = null;
26 private int mode;
27 private HashSet<String> pathlist = new HashSet<String>();
28 private Iterator<String> it = null;
29
30 public final void toDo(String path) throws Exception {
31 pathlist.add(path);
32 }
33
34 public final String next() {
35 return it.next();
36 }
37
38 public final boolean hasNext() {
39 return it.hasNext();
40 }
41
42 public final String toString() {
43 return pathlist.toString();
44 }
45 }