@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof EmptySet) { union.replaceWith(rightArg); } else if (rightArg instanceof EmptySet) { union.replaceWith(leftArg); } else if (leftArg instanceof SingletonSet && rightArg instanceof SingletonSet) { union.replaceWith(leftArg); } }
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof Join && rightArg instanceof Join) { Join leftJoinArg = (Join)leftArg; Join rightJoin = (Join)rightArg; if (leftJoinArg.getLeftArg().equals(rightJoin.getLeftArg())) { // factor out the left-most join argument Join newJoin = new Join(); union.replaceWith(newJoin); newJoin.setLeftArg(leftJoinArg.getLeftArg()); newJoin.setRightArg(union); union.setLeftArg(leftJoinArg.getRightArg()); union.setRightArg(rightJoin.getRightArg()); union.visit(this); } } } }
@Override public void meet(Union union) { super.meet(union); TupleExpr leftArg = union.getLeftArg(); TupleExpr rightArg = union.getRightArg(); if (leftArg instanceof Join && rightArg instanceof Join) { Join leftJoinArg = (Join)leftArg; Join rightJoin = (Join)rightArg; if (leftJoinArg.getLeftArg().equals(rightJoin.getLeftArg())) { // factor out the left-most join argument Join newJoin = new Join(); union.replaceWith(newJoin); newJoin.setLeftArg(leftJoinArg.getLeftArg()); newJoin.setRightArg(union); union.setLeftArg(leftJoinArg.getRightArg()); union.setRightArg(rightJoin.getRightArg()); union.visit(this); } } } }