cowr.set(newNestedq); if(cowr.isCopied()) newq=new NaryLogicalExpression( ((NaryLogicalExpression)q).getOp(),cowr.getCopiedList()); } else if (q instanceof ArrayMatchExpression) {
if (cowr.isCopied()) { newq = new NaryLogicalExpression(((NaryLogicalExpression) q).getOp(), cowr.getCopiedList());
if (cowr.isCopied()) { newq = new NaryLogicalExpression(((NaryLogicalExpression) q).getOp(), cowr.getCopiedList());
if (itr.isCopied()) { List<QueryExpression> newList = itr.getCopiedList(); if (newList.size() == 0) {
if (itr.isCopied()) { List<QueryExpression> newList = itr.getCopiedList(); if (newList.size() == 0) {
@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; } }
/** * Default behavior is to recursively iterate the nested quereies. If nested * processing returns objects different from the original nested queries, * this method creates a new n-ary logical expression using the new query * expressions and returns that. */ protected QueryExpression itrNaryLogicalExpression(NaryLogicalExpression q, Path context) { CopyOnWriteIterator<QueryExpression> itr = new CopyOnWriteIterator<>(q.getQueries()); while (itr.hasNext()) { QueryExpression nestedq = itr.next(); QueryExpression newq = iterate(nestedq, context); if (newq != nestedq) { itr.set(newq); } } if (itr.isCopied()) { return new NaryLogicalExpression(q.getOp(), itr.getCopiedList()); } else { return q; } }
/** * Default behavior is to recursively iterate the nested quereies. If nested * processing returns objects different from the original nested queries, * this method creates a new n-ary logical expression using the new query * expressions and returns that. */ protected QueryExpression itrNaryLogicalExpression(NaryLogicalExpression q, Path context) { CopyOnWriteIterator<QueryExpression> itr = new CopyOnWriteIterator<>(q.getQueries()); while (itr.hasNext()) { QueryExpression nestedq = itr.next(); QueryExpression newq = iterate(nestedq, context); if (newq != nestedq) { itr.set(newq); } } if (itr.isCopied()) { return new NaryLogicalExpression(q.getOp(), itr.getCopiedList()); } else { return q; } }