devutility.internal.util.function.PredicateBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devutility.internal Show documentation
Show all versions of devutility.internal Show documentation
Utilities for Java development
package devutility.internal.util.function;
import java.util.function.Predicate;
public class PredicateBuilder {
// region variables
private boolean hasPredicate = false;
private Predicate predicate;
// endregion
// region constructor
public PredicateBuilder() {
setPredicate(i -> true);
}
// endregion
// region and
public void and(Predicate expression) {
if (!hasPredicate) {
hasPredicate = true;
predicate = expression;
return;
}
predicate = predicate.and(expression);
}
// endregion
// region or
public void or(Predicate expression) {
if (!hasPredicate) {
hasPredicate = true;
predicate = (expression);
return;
}
predicate = (predicate.or(expression));
}
// endregion
// region predicate
public Predicate getPredicate() {
return predicate;
}
private void setPredicate(Predicate predicate) {
this.predicate = predicate;
}
// endregion
// region is has predicate
public boolean isHasPredicate() {
return hasPredicate;
}
// endregion
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy