Compare instance of predicates, not exact class

We want the same behavior for any instance of the boolean
predicates, not just for the exact boolean classes.

Change-Id: I2d1168c7a69e03db4b8dda3ddf60275a603c3e27
This commit is contained in:
Nasser Grainawi
2013-06-27 19:25:36 -06:00
committed by Dave Borowitz
parent ec4418b3e8
commit e12cf645de
3 changed files with 14 additions and 20 deletions

View File

@@ -54,11 +54,11 @@ public class QueryBuilder {
public static Query toQuery(Predicate<ChangeData> p)
throws QueryParseException {
if (p.getClass() == AndPredicate.class) {
if (p instanceof AndPredicate) {
return booleanQuery(p, MUST);
} else if (p.getClass() == OrPredicate.class) {
} else if (p instanceof OrPredicate) {
return booleanQuery(p, SHOULD);
} else if (p.getClass() == NotPredicate.class) {
} else if (p instanceof NotPredicate) {
if (p.getChild(0) instanceof TimestampRangePredicate) {
return notTimestampQuery(
(TimestampRangePredicate<ChangeData>) p.getChild(0));