@Override public void visit(final ForStmt n, final Object arg) { printJavaComment(n.getComment(), arg); printer.print("for ("); if (n.getInit() != null) { for (final Iterator<Expression> i = n.getInit().iterator(); i.hasNext();) { final Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print("; "); if (n.getCompare() != null) { n.getCompare().accept(this, arg); } printer.print("; "); if (n.getUpdate() != null) { for (final Iterator<Expression> i = n.getUpdate().iterator(); i.hasNext();) { final Expression e = i.next(); e.accept(this, arg); if (i.hasNext()) { printer.print(", "); } } } printer.print(") "); n.getBody().accept(this, arg); }
@Override public void visit(final ForStmt n, final A arg) { visitComment(n.getComment(), arg); if (n.getInit() != null) { for (final Expression e : n.getInit()) { e.accept(this, arg); } } if (n.getCompare() != null) { n.getCompare().accept(this, arg); } if (n.getUpdate() != null) { for (final Expression e : n.getUpdate()) { e.accept(this, arg); } } n.getBody().accept(this, arg); }
@Override public Node visit(ForStmt _n, Object _arg) { List<Expression> init = visit(_n.getInit(), _arg); Expression compare = cloneNodes(_n.getCompare(), _arg); List<Expression> update = visit(_n.getUpdate(), _arg); Statement body = cloneNodes(_n.getBody(), _arg); Comment comment = cloneNodes(_n.getComment(), _arg); ForStmt r = new ForStmt( _n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(), init, compare, update, body ); r.setComment(comment); return r; }