/** * Test whether or not a string matches against a pattern. * The pattern may contain two special characters:<br> * '*' means zero or more characters<br> * '?' means one and only one character * * @param pattern The pattern to match against. * Must not be <code>null</code>. * @param str The string which must be matched against the pattern. * Must not be <code>null</code>. * * @return <code>true</code> if the string matches against the pattern, * or <code>false</code> otherwise. */ public static boolean match(final String pattern, final String str) { return SelectorUtils.match(pattern, str); }
protected boolean accept(File pathname, final String path) { logger.debug("checking path: {}", path); for (final String include : this.includes) { if ((acceptDirectories && pathname.isDirectory()) || SelectorUtils.matchPath(include, path, false) || SelectorUtils.match(include, path, false)) { logger.debug("{} matches include {}", path, include); for (final String exclude : this.excludes) { if (SelectorUtils.matchPath(exclude, path, false)) { logger.debug("{} matches exclude {}", path, exclude); logger.debug("denied path: {}", path); return false; } else if (logger.isTraceEnabled()) { logger.trace("{} doesn't match exclude {}", path, exclude); } } logger.debug("acepted path: {}", path); return true; } else if (logger.isTraceEnabled()) { logger.trace("{} doesn't match include {}", path, include); } } logger.debug("denied path: {}", path); return false; } }
protected boolean accept(File pathname, final String path) { logger.debug("checking path: {}", path); for (final String include : this.includes) { if ((acceptDirectories && pathname.isDirectory()) || SelectorUtils.matchPath(include, path, false) || SelectorUtils.match(include, path, false)) { logger.debug("{} matches include {}", path, include); for (final String exclude : this.excludes) { if (SelectorUtils.matchPath(exclude, path, false)) { logger.debug("{} matches exclude {}", path, exclude); logger.debug("denied path: {}", path); return false; } else if (logger.isTraceEnabled()) { logger.trace("{} doesn't match exclude {}", path, exclude); } } logger.debug("acepted path: {}", path); return true; } else if (logger.isTraceEnabled()) { logger.trace("{} doesn't match include {}", path, include); } } logger.debug("denied path: {}", path); return false; } }
/** * Tests whether or not a string matches against a pattern. * The pattern may contain two special characters:<br> * '*' means zero or more characters<br> * '?' means one and only one character * * @param pattern The pattern to match against. * Must not be <code>null</code>. * @param str The string which must be matched against the pattern. * Must not be <code>null</code>. * * @return <code>true</code> if the string matches against the pattern, * or <code>false</code> otherwise. */ public static boolean match(String pattern, String str) { return match(pattern, str, true); }
/** * Test whether or not a string matches against a pattern. * The pattern may contain two special characters:<br> * '*' means zero or more characters<br> * '?' means one and only one character * * @param pattern The pattern to match against. * Must not be <code>null</code>. * @param str The string which must be matched against the pattern. * Must not be <code>null</code>. * @param isCaseSensitive Whether or not matching should be performed * case sensitively. * * * @return <code>true</code> if the string matches against the pattern, * or <code>false</code> otherwise. */ protected static boolean match(final String pattern, final String str, final boolean isCaseSensitive) { return SelectorUtils.match(pattern, str, isCaseSensitive); }
break; if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) { return false;
break; if (!match(patDir, strDirs[strIdxStart], isCaseSensitive)) { return false; break; if (!match(patDir, strDirs[strIdxEnd], isCaseSensitive)) { return false; String subPat = tokenizedPattern[patIdxStart + j + 1]; String subStr = strDirs[strIdxStart + i + j]; if (!match(subPat, subStr, isCaseSensitive)) { continue strLoop;
private boolean matches(String name) { if (pattern != null) { return SelectorUtils.match(modify(pattern), modify(name), cs); } if (reg == null) { reg = new RegularExpression(); reg.setPattern(regex); expression = reg.getRegexp(project); } return expression.matches(modify(name), RegexpUtil.asOptions(cs)); }
public void partialScan(PropertyFileAcceptor acceptor, File baseDir, PropertyScanner scanner, ScanConfiguration config, File singleFile) { Project antProject = new org.apache.tools.ant.Project(); FileSet fs = createFileSet(config); String[] excludes = fs.mergeExcludes(antProject); if(excludes!=null) { for (String exclude : excludes) { if(SelectorUtils.match(normalizePattern(exclude), singleFile.getPath())) return; } } String[] includes = fs.mergeIncludes(antProject); if(includes==null) return; for (String include : includes) { if(SelectorUtils.match(normalizePattern(include), singleFile.getPath())) { if (baseDir.exists()) { // if(scanner.isTemplate(singleFile, config)) { acceptor.newMatch(singleFile); // } } break; } } }