Examples of ForLoop


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

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

      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

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

  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

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

      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

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

      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

Examples of jadx.core.dex.regions.loops.ForLoop

    private void regionProcess(MethodNode mth, IRegion region) {
      if (region instanceof LoopRegion) {
        LoopRegion loopRegion = (LoopRegion) region;
        LoopType loopType = loopRegion.getType();
        if (loopType instanceof ForLoop) {
          ForLoop forLoop = (ForLoop) loopType;
          processInsn(forLoop.getInitInsn(), region);
          processInsn(forLoop.getIncrInsn(), region);
        }
      }
    }
View Full Code Here

Examples of jadx.core.dex.regions.loops.ForLoop

    LoopType arrForEach = checkArrayForEach(mth, initInsn, incrInsn, condition);
    if (arrForEach != null) {
      loopRegion.setType(arrForEach);
      return true;
    }
    loopRegion.setType(new ForLoop(initInsn, incrInsn));
    return true;
  }
View Full Code Here

Examples of jadx.core.dex.regions.loops.ForLoop

    }
    ConditionGen conditionGen = new ConditionGen(this);
    LoopType type = region.getType();
    if (type != null) {
      if (type instanceof ForLoop) {
        ForLoop forLoop = (ForLoop) type;
        code.startLine("for (");
        makeInsn(forLoop.getInitInsn(), code, Flags.INLINE);
        code.add("; ");
        conditionGen.add(code, condition);
        code.add("; ");
        makeInsn(forLoop.getIncrInsn(), code, Flags.INLINE);
        code.add(") {");
        makeRegionIndent(code, region.getBody());
        code.startLine('}');
        return code;
      }
View Full Code Here

Examples of net.asfun.jangod.util.ForLoop

    if ( helper.length != 3 ) {
      throw new InterpretException("Tag 'for' expects 3 helpers >>> " + helper.length);
    }
    String item = helper[0];
    Object collection = VariableFilter.compute( helper[2], interpreter);
    ForLoop loop = ObjectIterator.getLoop(collection);
   
    int level = interpreter.getLevel() + 1;
    interpreter.assignRuntimeScope(LOOP, loop, level);
    StringBuffer buff = new StringBuffer();
    while ( loop.hasNext() ) {
      //set item variable
      interpreter.assignRuntimeScope(item, loop.next(), level);
      for(Node node : carries) {
        buff.append(node.render(interpreter));
      }
    }
    return buff.toString();
View Full Code Here

Examples of org.jboss.errai.codegen.control.ForLoop

  @Override
  public BlockBuilder<StatementEnd> for_(final Statement initializer, final BooleanExpression condition,
      final Statement countingExpression) {

    final BlockStatement body = new BlockStatement();
    appendCallElement(new ConditionalBlockCallElement(new ForLoop(condition, body, initializer, countingExpression)));
    return createLoopBody(body);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.