@Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
@Override public LoopNode copyElements() { LoopNode copy = new LoopNode(getGraph()); copy.setIterations(iterations); copy.setCounterVariable(counter); SequentialNode newBody = body.copy(); newBody.removePredecessor(this); newBody.addPredecessor(copy); copy.setBody(newBody); copySubtree(newBody, copy); return copy; }
@Override public void visit(LoopNode node) { node.getCounterVariable().accept(this); node.getBody().accept(this); node.getSuccessor().accept(this); }
LoopNode loop = new LoopNode(graph); addNode(loop); rewireNodes(body, loop); loop.setBody((body != null && body.size() > 0) ? body.get(0) : new BlockEndNode(graph, loop)); loop.setIterations(Integer.parseInt(iterations)); + counter + " only as counter variable and do not assign Geometric Algebra expressions to it."); loop.setCounterVariable(counter); graph.removeLocalVariable(counter); graph.addScalarVariable(counter);
@Override public void visit(LoopNode node) { node.getSuccessor().accept(this); }
/** * Handles a loop statement. A CluCalc loop consists of a body of statements, typically containing the break * keyword. * * @param body list of statements belonging to body * @param iterations (optional) number of iterations for loop unrolling * @return new {@link LoopNode} representing this statement. */ public LoopNode handleLoop(List<SequentialNode> body, String iterations) { LoopNode loop = new LoopNode(graph); addNode(loop); rewireNodes(body, loop); loop.setBody((body != null && body.size() > 0) ? body.get(0) : new BlockEndNode(graph, loop)); // save number of iterations and reset value for next loops if (iterations != null) { loop.setIterations(Integer.parseInt(iterations)); } return loop; }
@Override public void visit(BreakNode node) { addNode(node, "break"); addForwardEdge(node, nestedLoops.peek().getSuccessor()); node.getSuccessor().accept(this); }
/** * {@inheritDoc} * * This empty implementation visits the successor node by default. */ @Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
/** * {@inheritDoc} * * This empty implementation visits the successor node by default. */ @Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { code.append("\\text{LOOP} \\\\\n"); node.getBody().accept(this); code.append("\\text{END LOOP} \\\\\n"); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { node.getBody().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { addNode(node, "loop"); addForwardEdge(node, node.getBody()); nestedLoops.push(node); node.getBody().accept(this); nestedLoops.pop(); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { appendIndent(); code.append("loop {\n"); indent++; node.getBody().accept(this); indent--; appendIndent(); code.append("}\n"); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { appendIndentation(); code.append("while(true) {\n"); indentation++; node.getBody().accept(this); indentation--; appendIndentation(); code.append("}\n"); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { appendIndent(); code.append("loop {\n"); indent++; node.getBody().accept(this); indent--; appendIndent(); code.append("}\n"); node.getSuccessor().accept(this); }
@Override public void visit(LoopNode node) { appendIndentation(); append("while(true) {\n"); indentation++; node.getBody().accept(this); indentation--; appendIndentation(); append("}\n"); node.getSuccessor().accept(this); }