@Test public void testEliminateNotOr() throws Exception { QueryExpression v1 = vcmp("f1", "!=", "1"); QueryExpression v2 = vcmp("f2", "<", "2"); QueryExpression qor = _or(v1, v2); QueryExpression qnot = _not(qor); QueryExpression newq = rw.rewrite(qnot); System.out.println(qnot + " ->\n" + newq); Assert.assertTrue(((NaryLogicalExpression) newq).getOp() == NaryLogicalOperator._and); Assert.assertTrue(exists(newq, vcmp("f1", "=", "1"))); Assert.assertTrue(exists(newq, vcmp("f2", ">=", "2"))); }
@Override public QueryExpression rewrite(QueryExpression q) { QueryExpression trc = q; QueryExpression newq; boolean done = false; do { newq = rewriteIteration(trc); LOGGER.debug("Rewrite iteration pre={}", trc); LOGGER.debug("Rewrite iteration post={}", newq); if (newq == trc) { done = true; } trc = newq; } while (!done); return newq; }
QueryRewriter extends Rewriter { @Override public QueryExpression rewrite(QueryExpression q) { QueryExpression trc = q; QueryExpression newq; boolean done = false; do { newq = rewriteIteration(trc); LOGGER.debug("Rewrite iteration pre={}", trc); LOGGER.debug("Rewrite iteration post={}", newq); if (newq == trc) { done = true; } trc = newq; } while (!done); return newq; } }
QueryRewriter extends Rewriter { @Override public QueryExpression rewrite(QueryExpression q) { QueryExpression trc = q; QueryExpression newq; boolean done = false; do { newq = rewriteIteration(trc); LOGGER.debug("Rewrite iteration pre={}", trc); LOGGER.debug("Rewrite iteration post={}", newq); if (newq == trc) { done = true; } trc = newq; } while (!done); return newq; } QueryRewriter();  QueryRewriter(boolean withDefaultRules); }
QueryRewriter extends Rewriter { @Override public QueryExpression rewrite(QueryExpression q) { QueryExpression trc = q; QueryExpression newq; boolean done = false; do { newq = rewriteIteration(trc); LOGGER.debug("Rewrite iteration pre={}", trc); LOGGER.debug("Rewrite iteration post={}", newq); if (newq == trc) { done = true; } trc = newq; } while (!done); return newq; } QueryRewriter();  QueryRewriter(boolean withDefaultRules); void register(Rewriter rule); @Override QueryExpression rewrite(QueryExpression q); }
QueryRewriter extends Rewriter { @Override public QueryExpression rewrite(QueryExpression q) { QueryExpression trc = q; QueryExpression newq; boolean done = false; do { newq = rewriteIteration(trc); LOGGER.debug("Rewrite iteration pre={}", trc); LOGGER.debug("Rewrite iteration post={}", newq); if (newq == trc) { done = true; } trc = newq; } while (!done); return newq; } QueryRewriter();  QueryRewriter(boolean withDefaultRules); void register(Rewriter rule); @Override QueryExpression rewrite(QueryExpression q);  }