@Test public void testAccept() { String regex = "a.*\\.b"; Path matchedPath = new Path("fsuri: Path unmatchedPath = new Path("fsuri: RegexPathFilter includeFilter = new RegexPathFilter(regex); RegexPathFilter excludeFilter = new RegexPathFilter(regex, false); Assert.assertTrue(includeFilter.accept(matchedPath)); Assert.assertFalse(includeFilter.accept(unmatchedPath)); Assert.assertFalse(excludeFilter.accept(matchedPath)); Assert.assertTrue(excludeFilter.accept(unmatchedPath)); }
@Override public boolean accept(Path path) { boolean matches = this.regex.matcher(path.getName()).matches(); return include ? matches : !matches; }
RegexPathFilter implements PathFilter { @Override public boolean accept(Path path) { boolean matches = this.regex.matcher(path.getName()).matches(); return include ? matches : !matches; } }
RegexPathFilter implements PathFilter { @Override public boolean accept(Path path) { boolean matches = this.regex.matcher(path.getName()).matches(); return include ? matches : !matches; } RegexPathFilter(String regex);  RegexPathFilter(String regex, boolean include); }
RegexPathFilter implements PathFilter { @Override public boolean accept(Path path) { boolean matches = this.regex.matcher(path.getName()).matches(); return include ? matches : !matches; } RegexPathFilter(String regex);  RegexPathFilter(String regex, boolean include); @Override boolean accept(Path path); }
RegexPathFilter implements PathFilter { @Override public boolean accept(Path path) { boolean matches = this.regex.matcher(path.getName()).matches(); return include ? matches : !matches; } RegexPathFilter(String regex);  RegexPathFilter(String regex, boolean include); @Override boolean accept(Path path);  }