Package com.google.gwt.dev.generator.ast

Examples of com.google.gwt.dev.generator.ast.ForLoop


  private Statements benchmark(Statements stmts, String timeMillisName,
      long bound, Statements recordCode, Statements breakCode) {
    Statements benchmarkCode = new StatementsList();
    List<Statements> benchStatements = benchmarkCode.getStatements();

    ForLoop loop = new ForLoop("int numLoops = 1", "true", "");
    benchStatements.add(loop);
    List<Statements> loopStatements = loop.getStatements();

    loopStatements.add(new Statement("long start = System.currentTimeMillis()"));
    ForLoop runLoop = new ForLoop("int i = 0", "i < numLoops", "++i", stmts);
    loopStatements.add(runLoop);

    // Put the rest of the code in 1 big statement to simplify things
    String benchCode = "long duration = System.currentTimeMillis() - start;\n\n"
        +
View Full Code Here


      Statements breakCode = new Statement("  break " + ESCAPE_LOOP);

      setupBench = benchmark(setupBench, setupTimingName, 0, null, breakCode);
      testBench = benchmark(testBench, testTimingName, getDefaultTimeout(),
          new Statement(recordResultsCode), breakCode);
      ForLoop loop = (ForLoop) testBench.getStatements().get(0);
      loop.setLabel(ESCAPE_LOOP);

      sw.println(setupBench.toString());
      sw.println(testBench.toString());

      sw.outdent();
View Full Code Here

  private Statements benchmark(Statements stmts, String timeMillisName,
      boolean generateEscape, Statements recordCode, Statements breakCode) {
    Statements benchmarkCode = new StatementsList();
    List benchStatements = benchmarkCode.getStatements();

    ForLoop loop = new ForLoop("int numLoops = 1", "true", "");
    benchStatements.add(loop);
    List loopStatements = loop.getStatements();

    loopStatements
        .add(new Statement("long start = System.currentTimeMillis()"));
    ForLoop runLoop = new ForLoop("int i = 0", "i < numLoops", "++i", stmts);
    loopStatements.add(runLoop);

    // Put the rest of the code in 1 big statement to simplify things
    String benchCode =
        "long duration = System.currentTimeMillis() - start;\n\n" +
View Full Code Here

      String paramValue = (String) params.get(paramName);

      String iteratorName = "it_" + paramName;
      String initializer = "java.util.Iterator " + iteratorName + " = "
          + paramValue + ".iterator()";
      ForLoop loop = new ForLoop(initializer, iteratorName + ".hasNext()", "");
      if (i == methodParams.length - 1) {
        loop.setLabel(ESCAPE_LOOP);
      }
      currentContext.getStatements().add(loop);
      String typeName = methodParam.getType().getQualifiedSourceName();
      loop.getStatements().add(new Statement(typeName + " " + paramName + " = ("
          + typeName + ") " + iteratorName + ".next()"));
      currentContext = loop;
    }

    currentContext.getStatements().add(statements);
View Full Code Here

      Statements breakCode = new Statement( "  break " + ESCAPE_LOOP );

      setupBench = benchmark(setupBench, setupTimingName, false, null, breakCode);
      testBench = benchmark(testBench, testTimingName, true,
          new Statement(recordResultsCode), breakCode);
      ForLoop loop = (ForLoop) testBench.getStatements().get(0);
      loop.setLabel(ESCAPE_LOOP);

      sw.println(setupBench.toString());
      sw.println(testBench.toString());

      sw.outdent();
View Full Code Here

TOP

Related Classes of com.google.gwt.dev.generator.ast.ForLoop

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.