示例#1
0
  public boolean visit(ForStatement s) throws Exception {
    Map<String, String> parameters = createInitialParameters(s);
    xmlWriter.startTag("ForStatement", parameters);

    xmlWriter.startTag("Initializations", new HashMap<String, String>());
    for (Expression initialization : s.getInitializations()) {
      initialization.traverse(this);
    }
    xmlWriter.endTag("Initializations");

    xmlWriter.startTag("Conditions", new HashMap<String, String>());
    for (Expression condition : s.getConditions()) {
      condition.traverse(this);
    }
    xmlWriter.endTag("Conditions");

    xmlWriter.startTag("Increasements", new HashMap<String, String>());
    for (Expression increasement : s.getIncreasements()) {
      increasement.traverse(this);
    }
    xmlWriter.endTag("Increasements");

    s.getAction().traverse(this);

    return false;
  }
示例#2
0
 @Override
 public Void visitForStatement(ForStatement node) {
   Expression initialization = node.getInitialization();
   writer.print("for (");
   if (initialization != null) {
     visit(initialization);
   } else {
     visit(node.getVariables());
   }
   writer.print(";");
   visit(" ", node.getCondition());
   writer.print(";");
   visitList(" ", node.getUpdaters(), ", ");
   writer.print(") ");
   visit(node.getBody());
   return null;
 }
 /*
  * @see ASTVisitor#visit(ForStatement)
  */
 @Override
 public boolean visit(ForStatement node) {
   this.fBuffer.append("for ("); // $NON-NLS-1$
   for (Iterator<Expression> it = node.initializers().iterator(); it.hasNext(); ) {
     Expression e = it.next();
     e.accept(this);
   }
   this.fBuffer.append("; "); // $NON-NLS-1$
   if (node.getExpression() != null) {
     node.getExpression().accept(this);
   }
   this.fBuffer.append("; "); // $NON-NLS-1$
   for (Iterator<Expression> it = node.updaters().iterator(); it.hasNext(); ) {
     Expression e = it.next();
     e.accept(this);
   }
   this.fBuffer.append(") "); // $NON-NLS-1$
   node.getBody().accept(this);
   return false;
 }
示例#4
0
 public void visit(ForStatement node) {
   visit(node.getVariable().getExpression());
   visit(node.getCollection());
   visitAll(node.block());
 }
 public void visitForLoop(ForStatement forLoop) {
   forLoop.getCollectionExpression().visit(this);
   forLoop.getLoopBlock().visit(this);
 }