use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testAnd_whenBothPredicatesAnd.
@Test
public void testAnd_whenBothPredicatesAnd() {
AndPredicate predicate1 = new AndPredicate(new SqlPredicate("a == 1"), new SqlPredicate("a == 2"));
AndPredicate predicate2 = new AndPredicate(new SqlPredicate("a == 3"));
AndPredicate concatenatedOr = SqlPredicate.flattenCompound(predicate1, predicate2, AndPredicate.class);
assertEquals(3, concatenatedOr.getPredicates().length);
}
use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testFlattenOr_withOrAndPredicates.
// (OR (OR A B) (AND C D)) is flattened to (OR A B (AND C D))
@Test
public void testFlattenOr_withOrAndPredicates() {
OrPredicate orPredicate = new OrPredicate(leftOfOr, rightOfOr);
AndPredicate andPredicate = new AndPredicate(leftOfAnd, rightOfAnd);
OrPredicate flattenedCompoundOr = SqlPredicate.flattenCompound(orPredicate, andPredicate, OrPredicate.class);
assertSame(leftOfOr, flattenedCompoundOr.getPredicates()[0]);
assertSame(rightOfOr, flattenedCompoundOr.getPredicates()[1]);
assertSame(andPredicate, flattenedCompoundOr.getPredicates()[2]);
}
Aggregations