org.sonar.api.batch.fs.internal
Class AbstractFilePredicate

java.lang.Object
  extended by org.sonar.api.batch.fs.internal.AbstractFilePredicate
All Implemented Interfaces:
Comparable<OptimizedFilePredicate>, FilePredicate, OptimizedFilePredicate
Direct Known Subclasses:
RelativePathPredicate

public abstract class AbstractFilePredicate
extends Object
implements OptimizedFilePredicate

Partial implementation of FilePredicate.

Since:
5.1

Field Summary
protected static int DEFAULT_PRIORITY
           
protected static int USE_INDEX
           
 
Constructor Summary
AbstractFilePredicate()
           
 
Method Summary
 int compareTo(OptimizedFilePredicate o)
           
 Iterable<InputFile> filter(Iterable<InputFile> target)
          Filter provided files to keep only the ones that are valid for this predicate
 Iterable<InputFile> get(FileSystem.Index index)
          Get all files that are valid for this predicate.
 int priority()
          For optimization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sonar.api.batch.fs.FilePredicate
apply
 

Field Detail

DEFAULT_PRIORITY

protected static final int DEFAULT_PRIORITY
See Also:
Constant Field Values

USE_INDEX

protected static final int USE_INDEX
See Also:
Constant Field Values
Constructor Detail

AbstractFilePredicate

public AbstractFilePredicate()
Method Detail

filter

public Iterable<InputFile> filter(Iterable<InputFile> target)
Description copied from interface: OptimizedFilePredicate
Filter provided files to keep only the ones that are valid for this predicate

Specified by:
filter in interface OptimizedFilePredicate

get

public Iterable<InputFile> get(FileSystem.Index index)
Description copied from interface: OptimizedFilePredicate
Get all files that are valid for this predicate.

Specified by:
get in interface OptimizedFilePredicate

priority

public int priority()
Description copied from interface: OptimizedFilePredicate
For optimization. FilePredicates will be applied in priority order. For example when doing p.and(p1, p2, p3) then p1, p2 and p3 will be applied according to their priority value. Higher priority value are applied first. Assign a high priority when the predicate will likely highly reduce the set of InputFiles to filter. Also RelativePathPredicate and AbsolutePathPredicate have a high priority since they are using cache index.

Specified by:
priority in interface OptimizedFilePredicate

compareTo

public final int compareTo(OptimizedFilePredicate o)
Specified by:
compareTo in interface Comparable<OptimizedFilePredicate>


Copyright © 2009–2015 SonarSource. All rights reserved.