protected DefaultFileSystem(Path baseDir, Cache cache) { this.baseDir = baseDir; this.cache = cache; this.predicates = new DefaultFilePredicates(this.baseDir); }
@Override public FilePredicate hasPath(String s) { File file = new File(s); if (file.isAbsolute()) { return hasAbsolutePath(s); } return hasRelativePath(s); }
@Override public FilePredicate hasLanguages(String... languages) { List<FilePredicate> list = new ArrayList<>(); for (String language : languages) { list.add(hasLanguage(language)); } return or(list); }
@Override public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns) { if (exclusionPatterns.length == 0) { return TruePredicate.TRUE; } return not(matchesPathPatterns(exclusionPatterns)); }
@Override public FilePredicate doesNotMatchPathPattern(String exclusionPattern) { return not(matchesPathPattern(exclusionPattern)); }
@Override public FilePredicate matchesPathPatterns(String[] inclusionPatterns) { if (inclusionPatterns.length == 0) { return TruePredicate.TRUE; } FilePredicate[] predicates = new FilePredicate[inclusionPatterns.length]; for (int i = 0; i < inclusionPatterns.length; i++) { predicates[i] = new PathPatternPredicate(PathPattern.create(inclusionPatterns[i])); } return or(predicates); }
@Override public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns) { if (exclusionPatterns.length == 0) { return TruePredicate.TRUE; } return not(matchesPathPatterns(exclusionPatterns)); }
@Override public FilePredicate doesNotMatchPathPattern(String exclusionPattern) { return not(matchesPathPattern(exclusionPattern)); }
@Override public FilePredicate matchesPathPatterns(String[] inclusionPatterns) { if (inclusionPatterns.length == 0) { return TruePredicate.TRUE; } FilePredicate[] predicates = new FilePredicate[inclusionPatterns.length]; for (int i = 0; i < inclusionPatterns.length; i++) { predicates[i] = new PathPatternPredicate(PathPattern.create(inclusionPatterns[i])); } return or(predicates); }
@Override public FilePredicate is(File ioFile) { if (ioFile.isAbsolute()) { return hasAbsolutePath(ioFile.getAbsolutePath()); } return hasRelativePath(ioFile.getPath()); }
@Override public FilePredicate hasLanguages(Collection<String> languages) { List<FilePredicate> list = new ArrayList<>(); for (String language : languages) { list.add(hasLanguage(language)); } return or(list); }
@Before public void before() throws IOException { predicates = new DefaultFilePredicates(temp.newFolder().toPath()); }
@Override public FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns) { if (exclusionPatterns.length == 0) { return TruePredicate.TRUE; } return not(matchesPathPatterns(exclusionPatterns)); }
@Override public FilePredicate doesNotMatchPathPattern(String exclusionPattern) { return not(matchesPathPattern(exclusionPattern)); }
@Override public FilePredicate matchesPathPatterns(String[] inclusionPatterns) { if (inclusionPatterns.length == 0) { return TruePredicate.TRUE; } FilePredicate[] predicates = new FilePredicate[inclusionPatterns.length]; for (int i = 0; i < inclusionPatterns.length; i++) { predicates[i] = new PathPatternPredicate(PathPattern.create(inclusionPatterns[i])); } return or(predicates); }
@Override public FilePredicate hasPath(String s) { File file = new File(s); if (file.isAbsolute()) { return hasAbsolutePath(s); } return hasRelativePath(s); }
@Override public FilePredicate hasLanguages(Collection<String> languages) { List<FilePredicate> list = new ArrayList<FilePredicate>(); for (String language : languages) { list.add(hasLanguage(language)); } return or(list); }
@Before public void before() throws IOException { predicates = new DefaultFilePredicates(temp.newFolder().toPath()); javaFile = new TestInputFileBuilder("foo", "src/main/java/struts/Action.java") .setModuleBaseDir(moduleBasePath) .setLanguage("java") .setStatus(Status.SAME) .build(); }
@Override public FilePredicate hasPath(String s) { File file = new File(s); if (file.isAbsolute()) { return hasAbsolutePath(s); } return hasRelativePath(s); }
@Override public FilePredicate hasLanguages(String... languages) { List<FilePredicate> list = new ArrayList<>(); for (String language : languages) { list.add(hasLanguage(language)); } return or(list); }