public static Set<File> findMatchingOutputDirectoryByModel(final Map<String, String> toMatch, final File from) { final HashSet<File> matching = new HashSet<File>(); _findMatchingOutputDirectoryByModel(matching, toMatch, from); return matching; }
public static Set<File> findMatchingOutputDirectoryByModel(final Map<String, String> toMatch, final File from) { final HashSet<File> matching = new HashSet<File>(); _findMatchingOutputDirectoryByModel(matching, toMatch, from); return matching; }
private static void _findMatchingOutputDirectoryByModel(final Set<File> matching, final Map<String, String> toMatch, final File from) { if (from.getName().startsWith(".")) return; if (from.isDirectory()) { final File[] files = from.listFiles(); if (files != null) { for (final File file : files) { _findMatchingOutputDirectoryByModel(matching, toMatch, file); } } } else { String name = from.getName(); if (name.endsWith(".class") && toMatch.containsKey(name = name.substring(0, name.length() - 6)) && Arrays.stream(candidateOutputDirectories).anyMatch(s -> from.getAbsolutePath().contains(s))) { final String full = toMatch.get(name); final ReverseMatchResult res = reversePathMatch(full, from); if (res.isMatch()) { matching.add(res.getMatchRoot()); } } } }
private static void _findMatchingOutputDirectoryByModel(final Set<File> matching, final Map<String, String> toMatch, final File from) { if (from.getName().startsWith(".")) return; if (from.isDirectory()) { final File[] files = from.listFiles(); if (files != null) { for (final File file : files) { _findMatchingOutputDirectoryByModel(matching, toMatch, file); } } } else { String name = from.getName(); if (name.endsWith(".class") && toMatch.containsKey(name = name.substring(0, name.length() - 6)) && Arrays.stream(candidateOutputDirectories).anyMatch(s -> from.getAbsolutePath().contains(s))) { final String full = toMatch.get(name); final ReverseMatchResult res = reversePathMatch(full, from); if (res.isMatch()) { matching.add(res.getMatchRoot()); } } } }