@Test public void containsUnescapedChars() { char[] specialChars = new char[] { '*', '{', '}' }; boolean result; result = Globber.containsUnescapedChars("", specialChars); assertThat(result, is(false)); result = Globber.containsUnescapedChars("a", specialChars); assertThat(result, is(false)); result = Globber.containsUnescapedChars("*", specialChars); assertThat(result, is(true)); result = Globber.containsUnescapedChars("{", specialChars); assertThat(result, is(true)); result = Globber.containsUnescapedChars("}", specialChars); assertThat(result, is(true)); result = Globber.containsUnescapedChars("\\*", specialChars); assertThat(result, is(false)); result = Globber.containsUnescapedChars("\\*\\{.java\\}", specialChars); assertThat(result, is(false)); }
static boolean containsUnescapedChars(String s, char[] targets) { boolean escaped = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escaped) { escaped = true; } else { if (!escaped) { for (int j = 0; j < targets.length; j++) { if (c == targets[j]) { return true; } } } escaped = false; } } return false; }
Globber { static boolean containsUnescapedChars(String s, char[] targets) { boolean escaped = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escaped) { escaped = true; } else { if (!escaped) { for (int j = 0; j < targets.length; j++) { if (c == targets[j]) { return true; } } } escaped = false; } } return false; } }
Globber { static boolean containsUnescapedChars(String s, char[] targets) { boolean escaped = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escaped) { escaped = true; } else { if (!escaped) { for (int j = 0; j < targets.length; j++) { if (c == targets[j]) { return true; } } } escaped = false; } } return false; } Globber();  Globber(String root);  Globber(Path root); }
Globber { static boolean containsUnescapedChars(String s, char[] targets) { boolean escaped = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escaped) { escaped = true; } else { if (!escaped) { for (int j = 0; j < targets.length; j++) { if (c == targets[j]) { return true; } } } escaped = false; } } return false; } Globber();  Globber(String root);  Globber(Path root); Globber include(String glob); Globber include(PathMatcher matcher); Globber exclude(String glob); Globber exclude(PathMatcher matcher); Globber recursive(); Globber recursive(boolean recursive); Globber dirsOnly(); Globber dirsOnly(boolean dirsOnly); Globber filesOnly(); Globber filesOnly(boolean filesOnly); Globber visibleOnly(); Globber visibleOnly(boolean visibleOnly); Stream<Path> stream(); Path scanOne(); Path scanOne(boolean required); List<Path> scan(); static Globber globber(String root, String glob); static Globber globber(Path root, String glob); static Globber globber(String rootWithGlob); static int detectGlobIndex(List<String> paths); }
Globber { static boolean containsUnescapedChars(String s, char[] targets) { boolean escaped = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escaped) { escaped = true; } else { if (!escaped) { for (int j = 0; j < targets.length; j++) { if (c == targets[j]) { return true; } } } escaped = false; } } return false; } Globber();  Globber(String root);  Globber(Path root); Globber include(String glob); Globber include(PathMatcher matcher); Globber exclude(String glob); Globber exclude(PathMatcher matcher); Globber recursive(); Globber recursive(boolean recursive); Globber dirsOnly(); Globber dirsOnly(boolean dirsOnly); Globber filesOnly(); Globber filesOnly(boolean filesOnly); Globber visibleOnly(); Globber visibleOnly(boolean visibleOnly); Stream<Path> stream(); Path scanOne(); Path scanOne(boolean required); List<Path> scan(); static Globber globber(String root, String glob); static Globber globber(Path root, String glob); static Globber globber(String rootWithGlob); static int detectGlobIndex(List<String> paths); static final char[] JAVA_GLOBBING_CHARS; }