Mercurial > hg4j
comparison src/org/tmatesoft/hg/util/FileWalker.java @ 608:e1b29756f901
Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 07 May 2013 21:27:51 +0200 |
| parents | bd5926e24aa3 |
| children |
comparison
equal
deleted
inserted
replaced
| 607:66f1cc23b906 | 608:e1b29756f901 |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011-2012 TMate Software Ltd | 2 * Copyright (c) 2011-2013 TMate Software Ltd |
| 3 * | 3 * |
| 4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
| 5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
| 6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
| 7 * | 7 * |
| 39 private final boolean execCap, linkCap; | 39 private final boolean execCap, linkCap; |
| 40 private final SessionContext sessionContext; | 40 private final SessionContext sessionContext; |
| 41 private RegularFileInfo nextFile; | 41 private RegularFileInfo nextFile; |
| 42 private Path nextPath; | 42 private Path nextPath; |
| 43 | 43 |
| 44 // TODO FileWalker to accept SessionContext.Source and SessionContext to implement SessionContext.Source | |
| 45 // (if it doesn't break binary compatibility) | |
| 46 public FileWalker(SessionContext ctx, File dir, Path.Source pathFactory) { | 44 public FileWalker(SessionContext ctx, File dir, Path.Source pathFactory) { |
| 47 this(ctx, dir, pathFactory, null); | 45 this(ctx, dir, pathFactory, null); |
| 48 } | 46 } |
| 47 | |
| 48 /** | |
| 49 * @see FileWalker#FileWalker(SessionContext, File, Path.Source, Matcher) | |
| 50 */ | |
| 51 public FileWalker(SessionContext.Source ctxSource, File dir, Path.Source pathFactory, Path.Matcher scopeMatcher) { | |
| 52 this(ctxSource.getSessionContext(), dir, pathFactory, scopeMatcher); | |
| 53 } | |
| 49 | 54 |
| 50 /** | 55 /** |
| 56 * Implementation of {@link FileIterator} with regular {@link java.io.File}. | |
| 51 * | 57 * |
| 52 * @param dir | 58 * @param dir directory to start at, not <code>null</code> |
| 53 * @param pathFactory | 59 * @param pathFactory factory to create {@link Path} instances, not <code>null</code> |
| 54 * @param scopeMatcher - this matcher shall be capable to tell not only files of interest, but | 60 * @param scopeMatcher - this matcher shall be capable to tell not only files of interest, but |
| 55 * also whether directories shall be traversed or not (Paths it gets in {@link Path.Matcher#accept(Path)} may | 61 * also whether directories shall be traversed or not (Paths it gets in {@link Path.Matcher#accept(Path)} may |
| 56 * point to directories) | 62 * point to directories); may be <code>null</code> |
| 57 */ | 63 */ |
| 58 public FileWalker(SessionContext ctx, File dir, Path.Source pathFactory, Path.Matcher scopeMatcher) { | 64 public FileWalker(SessionContext ctx, File dir, Path.Source pathFactory, Path.Matcher scopeMatcher) { |
| 59 sessionContext = ctx; | 65 sessionContext = ctx; |
| 60 startDir = dir; | 66 startDir = dir; |
| 61 pathHelper = pathFactory; | 67 pathHelper = pathFactory; |
