Browse Source

cleanup

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@696348 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
be9a928665
3 changed files with 7 additions and 41 deletions
  1. +2
    -12
      src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
  2. +5
    -1
      src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
  3. +0
    -28
      src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java

+ 2
- 12
src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java View File

@@ -188,7 +188,7 @@ public final class SelectorUtils {
*/
public static boolean matchPath(String pattern, String str) {
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,
boolean isCaseSensitive) {
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);
}

/**


+ 5
- 1
src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java View File

@@ -199,7 +199,11 @@ public class TokenizedPath {
return pathElements.length == 0 && !base.isDirectory() ? null : base;
}

/**
* Creates a TokenizedPattern from the same tokens that make up
* this path.
*/
public TokenizedPattern toPattern() {
return new TokenizedPattern(path, tokenizedPath);
return new TokenizedPattern(path, tokenizedPath);
}
}

+ 0
- 28
src/main/org/apache/tools/ant/types/selectors/TokenizedPattern.java View File

@@ -54,34 +54,6 @@ public class TokenizedPattern {
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.
*


Loading…
Cancel
Save