public void genBinaryExpression(Type type, Context ctx, TabbedWriter out, BinaryExpression arg) { out.print(getNativeStringPrefixOperation(arg)); out.print("("); ctx.invoke(genExpression, arg.getLHS(), ctx, out, arg.getOperation().getParameters().get(0)); out.print(getNativeStringOperation(arg)); ctx.invoke(genExpression, arg.getRHS(), ctx, out, arg.getOperation().getParameters().get(1)); out.print(getNativeStringComparisionOperation(arg)); out.print(")"); }
private Expression addWhenCriterion(Expression criterion, Expression condition) { if (condition instanceof BinaryExpression) { BinaryExpression binExp = (BinaryExpression) condition; Expression expr = addWhenCriterion(criterion, binExp.getLHS()); binExp.setLHS(expr); expr = addWhenCriterion(criterion, binExp.getRHS()); binExp.setRHS(expr); return condition; } else { BinaryExpression binExp = factory.createBinaryExpression(); binExp.setLHS(criterion); binExp.setRHS(condition); binExp.setOperator(Operation.EQUALS); return binExp; } }