@Override public QueryExpression rewrite(QueryExpression q) { NaryLogicalExpression le=dyncast(NaryLogicalExpression.class,q); if(le!=null) { if(le.getOp()==NaryLogicalOperator._and) { CopyOnWriteIterator<QueryExpression> itr=new CopyOnWriteIterator<>(le.getQueries()); while(itr.hasNext()) { QueryExpression x=itr.next(); NaryLogicalExpression nested=dyncast(NaryLogicalExpression.class,x); if(nested!=null&&nested.getOp()==NaryLogicalOperator._and) { // Remove this element, and add all its queries to the parent query itr.remove(); itr.getCopiedList().addAll(nested.getQueries()); } } if(itr.isCopied()) return new NaryLogicalExpression(NaryLogicalOperator._and,itr.getCopiedList()); } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { NaryLogicalExpression le = dyncast(NaryLogicalExpression.class, q); if (le != null) { if (le.getOp() == NaryLogicalOperator._and) { CopyOnWriteIterator<QueryExpression> itr = new CopyOnWriteIterator<>(le.getQueries()); while (itr.hasNext()) { QueryExpression x = itr.next(); NaryLogicalExpression nested = dyncast(NaryLogicalExpression.class, x); if (nested != null && nested.getOp() == NaryLogicalOperator._and) { // Remove this element, and add all its queries to the parent query itr.remove(); itr.getCopiedList().addAll(nested.getQueries()); } } if (itr.isCopied()) { return new NaryLogicalExpression(NaryLogicalOperator._and, itr.getCopiedList()); } } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { NaryLogicalExpression le = dyncast(NaryLogicalExpression.class, q); if (le != null) { if (le.getOp() == NaryLogicalOperator._and) { CopyOnWriteIterator<QueryExpression> itr = new CopyOnWriteIterator<>(le.getQueries()); while (itr.hasNext()) { QueryExpression x = itr.next(); NaryLogicalExpression nested = dyncast(NaryLogicalExpression.class, x); if (nested != null && nested.getOp() == NaryLogicalOperator._and) { // Remove this element, and add all its queries to the parent query itr.remove(); itr.getCopiedList().addAll(nested.getQueries()); } } if (itr.isCopied()) { return new NaryLogicalExpression(NaryLogicalOperator._and, itr.getCopiedList()); } } } return q; } }