001    /*
002     * SonarQube, open source software quality management tool.
003     * Copyright (C) 2008-2014 SonarSource
004     * mailto:contact AT sonarsource DOT com
005     *
006     * SonarQube is free software; you can redistribute it and/or
007     * modify it under the terms of the GNU Lesser General Public
008     * License as published by the Free Software Foundation; either
009     * version 3 of the License, or (at your option) any later version.
010     *
011     * SonarQube is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014     * Lesser General Public License for more details.
015     *
016     * You should have received a copy of the GNU Lesser General Public License
017     * along with this program; if not, write to the Free Software Foundation,
018     * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019     */
020    package org.sonar.api.batch.fs;
021    
022    import java.io.File;
023    import java.util.Collection;
024    
025    /**
026     * Factory of {@link org.sonar.api.batch.fs.FilePredicate}
027     *
028     * @since 4.2
029     */
030    public interface FilePredicates {
031      /**
032       * Returns a predicate that always evaluates to true
033       */
034      FilePredicate all();
035    
036      /**
037       * Returns a predicate that always evaluates to false
038       */
039      FilePredicate none();
040    
041      /**
042       * Warning - not efficient because absolute path is not indexed yet.
043       */
044      FilePredicate hasAbsolutePath(String s);
045    
046      /**
047       * TODO document that non-normalized path and Windows-style path are supported
048       */
049      FilePredicate hasRelativePath(String s);
050    
051      FilePredicate matchesPathPattern(String inclusionPattern);
052    
053      FilePredicate matchesPathPatterns(String[] inclusionPatterns);
054    
055      FilePredicate doesNotMatchPathPattern(String exclusionPattern);
056    
057      FilePredicate doesNotMatchPathPatterns(String[] exclusionPatterns);
058    
059      FilePredicate hasPath(String s);
060    
061      FilePredicate is(File ioFile);
062    
063      FilePredicate hasLanguage(String language);
064    
065      FilePredicate hasLanguages(Collection<String> languages);
066    
067      FilePredicate hasLanguages(String... languages);
068    
069      FilePredicate hasStatus(InputFile.Status status);
070    
071      FilePredicate hasType(InputFile.Type type);
072    
073      FilePredicate not(FilePredicate p);
074    
075      FilePredicate or(Collection<FilePredicate> or);
076    
077      FilePredicate or(FilePredicate... or);
078    
079      FilePredicate or(FilePredicate first, FilePredicate second);
080    
081      FilePredicate and(Collection<FilePredicate> and);
082    
083      FilePredicate and(FilePredicate... and);
084    
085      FilePredicate and(FilePredicate first, FilePredicate second);
086    
087    }