Mercurial > jhg
comparison src/org/tmatesoft/hg/util/Path.java @ 141:8248aae33f7d
Adopt FileIterator moving towards WCStatusCollector parameterizing. Improved path handling, move 'em around
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 17 Feb 2011 04:08:34 +0100 |
parents | 4a948ec83980 |
children | 1a7a9a20e1f9 |
comparison
equal
deleted
inserted
replaced
140:1c1891ad1c73 | 141:8248aae33f7d |
---|---|
78 | 78 |
79 /** | 79 /** |
80 * Path filter. | 80 * Path filter. |
81 */ | 81 */ |
82 public interface Matcher { | 82 public interface Matcher { |
83 public boolean accept(Path path); | 83 boolean accept(Path path); |
84 } | |
85 | |
86 /** | |
87 * Factory for paths | |
88 */ | |
89 public interface Source { | |
90 Path path(String p); | |
91 } | |
92 | |
93 /** | |
94 * Straightforward {@link Source} implementation that creates new Path instance for each supplied string | |
95 */ | |
96 public static class SimpleSource implements Source { | |
97 private final PathRewrite normalizer; | |
98 | |
99 public SimpleSource(PathRewrite pathRewrite) { | |
100 if (pathRewrite == null) { | |
101 throw new IllegalArgumentException(); | |
102 } | |
103 normalizer = pathRewrite; | |
104 } | |
105 | |
106 public Path path(String p) { | |
107 return Path.create(normalizer.rewrite(p)); | |
108 } | |
84 } | 109 } |
85 } | 110 } |