git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@696348 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -188,7 +188,7 @@ public final class SelectorUtils { | |||||
| */ | */ | ||||
| public static boolean matchPath(String pattern, String str) { | public static boolean matchPath(String pattern, String str) { | ||||
| String[] patDirs = tokenizePathAsArray(pattern); | String[] patDirs = tokenizePathAsArray(pattern); | ||||
| return matchPath(patDirs, str, true); | |||||
| return matchPath(patDirs, tokenizePathAsArray(str), true); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -212,17 +212,7 @@ public final class SelectorUtils { | |||||
| public static boolean matchPath(String pattern, String str, | public static boolean matchPath(String pattern, String str, | ||||
| boolean isCaseSensitive) { | boolean isCaseSensitive) { | ||||
| String[] patDirs = tokenizePathAsArray(pattern); | String[] patDirs = tokenizePathAsArray(pattern); | ||||
| return matchPath(patDirs, str, isCaseSensitive); | |||||
| } | |||||
| /** | |||||
| * Core implementation of matchPath. It is isolated so that it | |||||
| * can be called from TokenizedPattern. | |||||
| */ | |||||
| static boolean matchPath(String[] tokenizedPattern, String str, | |||||
| boolean isCaseSensitive) { | |||||
| return matchPath(tokenizedPattern, tokenizePathAsArray(str), | |||||
| isCaseSensitive); | |||||
| return matchPath(patDirs, tokenizePathAsArray(str), isCaseSensitive); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -199,7 +199,11 @@ public class TokenizedPath { | |||||
| return pathElements.length == 0 && !base.isDirectory() ? null : base; | return pathElements.length == 0 && !base.isDirectory() ? null : base; | ||||
| } | } | ||||
| /** | |||||
| * Creates a TokenizedPattern from the same tokens that make up | |||||
| * this path. | |||||
| */ | |||||
| public TokenizedPattern toPattern() { | public TokenizedPattern toPattern() { | ||||
| return new TokenizedPattern(path, tokenizedPath); | |||||
| return new TokenizedPattern(path, tokenizedPath); | |||||
| } | } | ||||
| } | } | ||||
| @@ -54,34 +54,6 @@ public class TokenizedPattern { | |||||
| this.tokenizedPattern = tokens; | this.tokenizedPattern = tokens; | ||||
| } | } | ||||
| /** | |||||
| * Tests whether or not a given path matches a given pattern. | |||||
| * | |||||
| * @param str The path to match, as a String. Must not be | |||||
| * <code>null</code>. | |||||
| * | |||||
| * @return <code>true</code> if the pattern matches against the string, | |||||
| * or <code>false</code> otherwise. | |||||
| */ | |||||
| public boolean matchPath(String str) { | |||||
| return SelectorUtils.matchPath(tokenizedPattern, str, true); | |||||
| } | |||||
| /** | |||||
| * Tests whether or not a given path matches a given pattern. | |||||
| * | |||||
| * @param str The path to match, as a String. Must not be | |||||
| * <code>null</code>. | |||||
| * @param isCaseSensitive Whether or not matching should be performed | |||||
| * case sensitively. | |||||
| * | |||||
| * @return <code>true</code> if the pattern matches against the string, | |||||
| * or <code>false</code> otherwise. | |||||
| */ | |||||
| public boolean matchPath(String str, boolean isCaseSensitive) { | |||||
| return SelectorUtils.matchPath(tokenizedPattern, str, isCaseSensitive); | |||||
| } | |||||
| /** | /** | ||||
| * Tests whether or not a given path matches a given pattern. | * Tests whether or not a given path matches a given pattern. | ||||
| * | * | ||||