All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.infix.Predicates Maven / Gradle / Ivy

The newest version!
package com.netflix.infix;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;

/**
 * A number of static helper methods to simplify the construction of combined event filters. 
 */
public class Predicates {

    private Predicates(){}
	
    public static Predicate alwaysTrue(){
		return AlwaysTruePredicate.INSTANCE;
	}
	
    public static Predicate alwaysFalse() {
		return AlwaysFalsePredicate.INSTANCE;
	}
	
    public static Predicate or(Predicate...filters) {
		return new OrPredicate(filters);
	}
	
	public static Predicate or(Iterable> filters) {
		return new OrPredicate(ImmutableList.copyOf(filters));
	}
	
    public static Predicate and(Predicate...filters) {
		return new AndPredicate(filters);
	}
	
	public static Predicate and(Iterable> filters){
		return new AndPredicate(ImmutableList.copyOf(filters));
	}
	
	public static Predicate not(Predicate filter) {
		return new NotPredicate(filter);
	}
}