@Override public Node visit(BinaryExpr _n, Object _arg) { Expression left = cloneNodes(_n.getLeft(), _arg); Expression right = cloneNodes(_n.getRight(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); BinaryExpr r = new BinaryExpr( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), left, right, _n.getOperator() ); r.setComment(comment); return r; }
@Override public Boolean visit(final BinaryExpr n1, final Node arg) { final BinaryExpr n2 = (BinaryExpr) arg; if (n1.getOperator() != n2.getOperator()) { return Boolean.FALSE; } if (!nodeEquals(n1.getLeft(), n2.getLeft())) { return Boolean.FALSE; } if (!nodeEquals(n1.getRight(), n2.getRight())) { return Boolean.FALSE; } return Boolean.TRUE; }
final public Expression ConditionalAndExpression() throws ParseException { Expression ret; Expression right; ret = InclusiveOrExpression(); label_26: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_AND: ; break; default: jj_la1[63] = jj_gen; break label_26; } jj_consume_token(SC_AND); right = InclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.and); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
@Override public void visit(final BinaryExpr n, final Object arg) { printJavaComment(n.getComment(), arg); n.getLeft().accept(this, arg); printer.print(" "); switch (n.getOperator()) { case or: printer.print("||"); n.getRight().accept(this, arg);
@Override public void visit(final BinaryExpr n, final A arg) { visitComment(n.getComment(), arg); n.getLeft().accept(this, arg); n.getRight().accept(this, arg); }
final public Expression InclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = ExclusiveOrExpression(); label_27: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_OR: ; break; default: jj_la1[64] = jj_gen; break label_27; } jj_consume_token(BIT_OR); right = ExclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binOr); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
public void visit(BinaryExpr n, Object arg) { n.getLeft().accept(this, arg); printer.print(" "); switch (n.getOperator()) { case or: printer.print("||"); n.getRight().accept(this, arg);
final public Expression AndExpression() throws ParseException { Expression ret; Expression right; ret = EqualityExpression(); label_29: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: ; break; default: jj_la1[65] = jj_gen; break label_29; } jj_consume_token(BIT_AND); right = EqualityExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binAnd); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression ConditionalOrExpression() throws ParseException { Expression ret; Expression right; ret = ConditionalAndExpression(); label_25: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_OR: ; break; default: jj_la1[62] = jj_gen; break label_25; } jj_consume_token(SC_OR); right = ConditionalAndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.or); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression InclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = ExclusiveOrExpression(); label_27: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_OR: ; break; default: jj_la1[63] = jj_gen; break label_27; } jj_consume_token(BIT_OR); right = ExclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binOr); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression ExclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = AndExpression(); label_28: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case XOR: ; break; default: jj_la1[64] = jj_gen; break label_28; } jj_consume_token(XOR); right = AndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.xor); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression ExclusiveOrExpression() throws ParseException { Expression ret; Expression right; ret = AndExpression(); label_28: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case XOR: ; break; default: jj_la1[65] = jj_gen; break label_28; } jj_consume_token(XOR); right = AndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.xor); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression ConditionalAndExpression() throws ParseException { Expression ret; Expression right; ret = InclusiveOrExpression(); label_26: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_AND: ; break; default: jj_la1[62] = jj_gen; break label_26; } jj_consume_token(SC_AND); right = InclusiveOrExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.and); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression AndExpression() throws ParseException { Expression ret; Expression right; ret = EqualityExpression(); label_29: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BIT_AND: ; break; default: jj_la1[66] = jj_gen; break label_29; } jj_consume_token(BIT_AND); right = EqualityExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.binAnd); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
final public Expression ConditionalOrExpression() throws ParseException { Expression ret; Expression right; ret = ConditionalAndExpression(); label_25: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SC_OR: ; break; default: jj_la1[61] = jj_gen; break label_25; } jj_consume_token(SC_OR); right = ConditionalAndExpression(); ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, BinaryExpr.Operator.or); } {if (true) return ret;} throw new Error("Missing return statement in function"); }
private NodeAndImports<MethodDeclaration> createPrimaryKeyEquals(Collection<FieldDescriptor> primaryKeyDescriptors, String enclosingClassName) { final MethodDeclaration equals = new MethodDeclaration(ModifierSet.PUBLIC, new PrimitiveType(PrimitiveType.Primitive.Boolean), "equals", Collections.singletonList(new Parameter(new ClassOrInterfaceType("Object"), new VariableDeclaratorId("other")))); equals.setAnnotations(Collections.<AnnotationExpr>singletonList(new MarkerAnnotationExpr(new NameExpr("Override")))); final Statement ifEqualNullStmt = new IfStmt(new BinaryExpr(new NameExpr("other"), new NullLiteralExpr(), BinaryExpr.Operator.equals), new ReturnStmt(new BooleanLiteralExpr(false)), null); final Statement ifEqualThisStmt = new IfStmt(new BinaryExpr(new NameExpr("other"), new ThisExpr(), BinaryExpr.Operator.equals), new ReturnStmt(new BooleanLiteralExpr(true)), null); final Statement ifEqualClassStmt = new IfStmt(new BinaryExpr(new MethodCallExpr(new NameExpr("other"), "getClass"), new MethodCallExpr(new ThisExpr(), "getClass"), BinaryExpr.Operator.notEquals), new ReturnStmt(new BooleanLiteralExpr(false)), null); final Statement rhsStmt = new ExpressionStmt(new VariableDeclarationExpr(ModifierSet.FINAL, new ClassOrInterfaceType(enclosingClassName), Collections.singletonList(new VariableDeclarator( new VariableDeclaratorId("rhs"), new CastExpr(new ClassOrInterfaceType(enclosingClassName), new NameExpr("other")))))); Expression equalsBuilderExpr = new ObjectCreationExpr(null, new ClassOrInterfaceType("EqualsBuilder"), Collections.<Expression>emptyList()); for (FieldDescriptor f : primaryKeyDescriptors) { final List<Expression> args = new ArrayList<Expression>(); args.add(new FieldAccessExpr(new ThisExpr(), f.getAttributeName())); args.add(new FieldAccessExpr(new NameExpr("rhs"), f.getAttributeName())); equalsBuilderExpr = new MethodCallExpr(equalsBuilderExpr, "append", args); } equalsBuilderExpr = new MethodCallExpr(equalsBuilderExpr, "isEquals"); final List<Statement> statements = new ArrayList<Statement>(); statements.add(ifEqualNullStmt); statements.add(ifEqualThisStmt); statements.add(ifEqualClassStmt); statements.add(rhsStmt); statements.add(new ReturnStmt(equalsBuilderExpr)); final BlockStmt equalsBody = new BlockStmt(statements); equals.setBody(equalsBody); return new NodeAndImports<MethodDeclaration>(equals, Collections.singleton(new ImportDeclaration(new QualifiedNameExpr(new NameExpr("org.apache.commons.lang.builder"), "EqualsBuilder"), false, false))); }
ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op);
ret = new BinaryExpr(ret.getBeginLine(), ret.getBeginColumn(), token.endLine, token.endColumn, ret, right, op);