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

org.joo.libra.logic.AndPredicate Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package org.joo.libra.logic;

import org.joo.libra.Predicate;
import org.joo.libra.PredicateContext;
import org.joo.libra.common.CompositionPredicate;
import org.joo.libra.support.PredicateExecutionException;

public class AndPredicate extends CompositionPredicate {

	private Predicate[] predicates;

	@SafeVarargs
	public AndPredicate(Predicate... predicates) {
		this.predicates = predicates;
	}

	@Override
	public boolean satisfiedBy(PredicateContext context) throws PredicateExecutionException {
		if (predicates == null) return true;
		for(Predicate predicate : predicates) {
			if (!predicate.satisfiedBy(context))
				return false;
		}
		return true;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy