use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testFlattenAnd_withTwoOrPredicates.
// (AND (OR A B) (OR C D)) is not flattened
@Test
public void testFlattenAnd_withTwoOrPredicates() {
OrPredicate orLeft = new OrPredicate(leftOfOr, rightOfOr);
OrPredicate orRight = new OrPredicate(leftOfAnd, rightOfAnd);
AndPredicate flattenedCompoundOr = SqlPredicate.flattenCompound(orLeft, orRight, AndPredicate.class);
assertSame(orLeft, flattenedCompoundOr.getPredicates()[0]);
assertSame(orRight, flattenedCompoundOr.getPredicates()[1]);
}
use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testAnd_whenNoPredicateAnd.
@Test
public void testAnd_whenNoPredicateAnd() {
TruePredicate predicate1 = new TruePredicate();
TruePredicate predicate2 = new TruePredicate();
AndPredicate concatenatedOr = SqlPredicate.flattenCompound(predicate1, predicate2, AndPredicate.class);
assertEquals(2, concatenatedOr.getPredicates().length);
assertSame(predicate1, concatenatedOr.getPredicates()[0]);
assertSame(predicate2, concatenatedOr.getPredicates()[1]);
}
use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testFlattenOr_withTwoAndPredicates.
// (OR (AND A B) (AND C D)) is not flattened
@Test
public void testFlattenOr_withTwoAndPredicates() {
AndPredicate andLeft = new AndPredicate(leftOfOr, rightOfOr);
AndPredicate andRight = new AndPredicate(leftOfAnd, rightOfAnd);
OrPredicate flattenedCompoundOr = SqlPredicate.flattenCompound(andLeft, andRight, OrPredicate.class);
assertSame(andLeft, flattenedCompoundOr.getPredicates()[0]);
assertSame(andRight, flattenedCompoundOr.getPredicates()[1]);
}
use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testFlattenAnd_withOrAndPredicates.
// (AND (OR A B) (AND C D)) is flattened to (AND (OR A B) C D)
@Test
public void testFlattenAnd_withOrAndPredicates() {
OrPredicate orPredicate = new OrPredicate(leftOfOr, rightOfOr);
AndPredicate andPredicate = new AndPredicate(leftOfAnd, rightOfAnd);
AndPredicate flattenedCompoundAnd = SqlPredicate.flattenCompound(orPredicate, andPredicate, AndPredicate.class);
assertSame(orPredicate, flattenedCompoundAnd.getPredicates()[0]);
assertSame(leftOfAnd, flattenedCompoundAnd.getPredicates()[1]);
assertSame(rightOfAnd, flattenedCompoundAnd.getPredicates()[2]);
}
use of com.hazelcast.query.impl.predicates.AndPredicate in project hazelcast by hazelcast.
the class SqlPredicateTest method testFlattenAnd_withAndORPredicates.
// (AND (AND A B) (OR C D)) is flattened to (AND A B (OR C D))
@Test
public void testFlattenAnd_withAndORPredicates() {
OrPredicate orPredicate = new OrPredicate(leftOfOr, rightOfOr);
AndPredicate andPredicate = new AndPredicate(leftOfAnd, rightOfAnd);
AndPredicate flattenedCompoundAnd = SqlPredicate.flattenCompound(andPredicate, orPredicate, AndPredicate.class);
assertSame(leftOfAnd, flattenedCompoundAnd.getPredicates()[0]);
assertSame(rightOfAnd, flattenedCompoundAnd.getPredicates()[1]);
assertSame(orPredicate, flattenedCompoundAnd.getPredicates()[2]);
}
Aggregations