List of usage examples for java.util.function Predicate or
default Predicate<T> or(Predicate<? super T> other)
From source file:org.talend.dataprep.filter.ObjectPredicateVisitor.java
@Override public Predicate<Object> visit(OrExpression orExpression) { final Expression[] expressions = orExpression.getExpressions(); if (expressions.length > 0) { Predicate<Object> predicate = (Predicate<Object>) expressions[0].accept(this); for (int i = 1; i < expressions.length; i++) { predicate = predicate.or((Predicate<Object>) expressions[i].accept(this)); }/*from w w w. j a va 2 s.c om*/ return predicate; } else { return m -> true; } }
From source file:org.talend.dataprep.filter.ObjectPredicateVisitor.java
@Override public Predicate<Object> visit(FieldInExpression fieldInExpression) { final Method[] methods = getMethods(fieldInExpression.getFieldName()); final LiteralValue[] values = fieldInExpression.getValues(); if (values.length > 0) { Predicate<Object> predicate = eq(values[0].accept(this), methods); for (int i = 1; i < values.length; i++) { predicate = predicate.or(eq(values[i].accept(this), methods)); }//from w w w .ja v a 2 s . co m return predicate; } else { return m -> true; } }
From source file:org.talend.tql.bean.BeanPredicateVisitor.java
@Override public Predicate<T> visit(OrExpression orExpression) { final Expression[] expressions = orExpression.getExpressions(); if (expressions.length > 0) { Predicate<T> predicate = expressions[0].accept(this); for (int i = 1; i < expressions.length; i++) { predicate = predicate.or(expressions[i].accept(this)); }/*from w w w .j a va2 s.c o m*/ return predicate; } else { return m -> true; } }
From source file:org.talend.tql.bean.BeanPredicateVisitor.java
@Override public Predicate<T> visit(ComparisonExpression comparisonExpression) { comparisonExpression.getValueOrField().accept(this); final Object value = literals.pop(); comparisonExpression.getField().accept(this); if (!currentMethods.isEmpty()) { Predicate<T> predicate = getComparisonPredicate(currentMethods.pop(), comparisonExpression, value); while (!currentMethods.isEmpty()) { predicate = predicate.or(getComparisonPredicate(currentMethods.pop(), comparisonExpression, value)); }/* w w w .j a va 2 s . c o m*/ return predicate; } else { return o -> true; } }
From source file:org.talend.tql.bean.BeanPredicateVisitor.java
@Override public Predicate<T> visit(FieldInExpression fieldInExpression) { fieldInExpression.getField().accept(this); final Method[] methods = currentMethods.pop(); final LiteralValue[] values = fieldInExpression.getValues(); if (values.length > 0) { Predicate<T> predicate = eq(values[0].accept(this), methods); for (LiteralValue value : values) { value.accept(this); predicate = predicate.or(eq(literals.pop(), methods)); }//from w w w . j a va2 s .c om return predicate; } else { return m -> true; } }