@Test public void testEliminateNot() throws Exception { QueryExpression v1 = _not(vcmp("f1", "!=", "1")); QueryExpression v2 = _not(vcmp("f2", "!=", "2")); QueryExpression v3 = _not(vcmp("f3", ">", "3")); QueryExpression v4 = _not(fcmp("f4", ">", "f5")); QueryExpression q = _and(v1, v2, v3, v4); QueryExpression newq = rw.rewrite(q); System.out.println(q + " ->\n" + newq); Assert.assertTrue(exists(newq, vcmp("f1", "=", "1"))); Assert.assertTrue(exists(newq, vcmp("f2", "=", "2"))); Assert.assertTrue(exists(newq, vcmp("f3", "<=", "3"))); Assert.assertTrue(exists(newq, fcmp("f4", "<=", "f5"))); }
@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);  }