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