/** * Test whether or not a given path matches the start of a given * pattern up to the first "**". * <p> * This is not a general purpose test and should only be used if you * can live with false positives. For example, <code>pattern=**\a</code> * and <code>str=b</code> will yield <code>true</code>. * * @param pattern The pattern to match against. Must not be * <code>null</code>. * @param str The path to match, as a String. Must not be * <code>null</code>. * * @return whether or not a given path matches the start of a given * pattern up to the first "**". */ protected static boolean matchPatternStart(final String pattern, final String str) { return SelectorUtils.matchPatternStart(pattern, str); }
/** * Tests whether or not a given path matches the start of a given * pattern up to the first "**". * <p> * This is not a general purpose test and should only be used if you * can live with false positives. For example, <code>pattern=**\a</code> * and <code>str=b</code> will yield <code>true</code>. * * @param pattern The pattern to match against. Must not be * <code>null</code>. * @param str The path to match, as a String. Must not be * <code>null</code>. * * @return whether or not a given path matches the start of a given * pattern up to the first "**". */ public static boolean matchPatternStart(String pattern, String str) { return matchPatternStart(pattern, str, true); }
/** * Test whether or not a given path matches the start of a given * pattern up to the first "**". * <p> * This is not a general purpose test and should only be used if you * can live with false positives. For example, <code>pattern=**\a</code> * and <code>str=b</code> will yield <code>true</code>. * * @param pattern The pattern to match against. Must not be * <code>null</code>. * @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 whether or not a given path matches the start of a given * pattern up to the first "**". */ protected static boolean matchPatternStart(final String pattern, final String str, final boolean isCaseSensitive) { return SelectorUtils.matchPatternStart(pattern, str, isCaseSensitive); }
/** * Tests whether or not this pattern matches the start of * a path. * * @param path TokenizedPath * @param caseSensitive boolean * @return boolean */ public boolean matchStartOf(TokenizedPath path, boolean caseSensitive) { return SelectorUtils.matchPatternStart(tokenizedPattern, path.getTokens(), caseSensitive); }
/** * true if the pattern specifies a relative path without basedir * or an absolute path not inside basedir. * * @since Ant 1.8.0 */ private boolean shouldSkipPattern(final String pattern) { if (FileUtils.isAbsolutePath(pattern)) { //skip abs. paths not under basedir, if set: return !(basedir == null || SelectorUtils.matchPatternStart(pattern, basedir.getAbsolutePath(), isCaseSensitive())); } return basedir == null; }
return matchPatternStart(patDirs, strDirs, isCaseSensitive);