comparison src/org/tmatesoft/hg/util/FileIterator.java @ 287:ed6b74a58c66

Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 07 Sep 2011 09:33:27 +0200
parents 26ad7827a62d
children 33eaed1ad130
comparison
equal deleted inserted replaced
286:954763c82cc3 287:ed6b74a58c66
13 * For information on how to redistribute this software under 13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.util; 17 package org.tmatesoft.hg.util;
18
19 import java.io.File;
20 18
21 import org.tmatesoft.hg.internal.Experimental; 19 import org.tmatesoft.hg.internal.Experimental;
22 20
23 /** 21 /**
24 * Abstracts iteration over file system. 22 * Abstracts iteration over file system.
47 * @return repository-local path to the current element. 45 * @return repository-local path to the current element.
48 */ 46 */
49 Path name(); 47 Path name();
50 48
51 /** 49 /**
52 * File object to retrieve actual state from. Not necessarily exist, if {@link FileIterator} is used to query status 50 * {@link FileInfo} object to retrieve actual file information. Caller shall not assume new instance for each {@link #next()} entry,
53 * of specific files. 51 * implementors of this interface may reuse {@link FileInfo} instance if deemed suitable.
54 * @return filesystem element. 52 * @return file information holder.
55 */ 53 */
56 File file(); 54 FileInfo file();
57 55
58 /** 56 /**
59 * When {@link FileIterator} represents only fraction of a repository, library might need to figure out if 57 * When {@link FileIterator} represents only fraction of a repository, library might need to figure out if
60 * specific file (path) belongs to that fraction or not. Paths (and {@link File Files} returned by this {@link FileIterator} 58 * specific file (path) belongs to that fraction or not. Paths and files returned by this {@link FileIterator}
61 * are always considered as representing the fraction, nonetheless, {@link FileIterator} shall return true for such names if 59 * are always considered as representing the fraction, nonetheless, {@link FileIterator} shall return true for such names if
62 * asked. 60 * asked.
63 * @return <code>true</code> if this {@link FileIterator} is responsible for (interested in) specified repository-local path 61 * @return <code>true</code> if this {@link FileIterator} is responsible for (interested in) specified repository-local path
64 */ 62 */
65 @Experimental(reason="Perhaps, shall not be part of FileIterator, but rather separate Path.Matcher. Approaches in regular StatusCollector (doesn't use FI, but supports scope) and WC collector to look similar, and for HgStatusCommand to use single approach to set the scope") 63 @Experimental(reason="Perhaps, shall not be part of FileIterator, but rather separate Path.Matcher. Approaches in regular StatusCollector (doesn't use FI, but supports scope) and WC collector to look similar, and for HgStatusCommand to use single approach to set the scope")