@Override public void visit(IfThenElseNode node) { String label = "if\\n" + node.getCondition().toString(); addNode(node, label); addForwardEdge(node, node.getPositive()); node.getPositive().accept(this); if (!(node.getNegative() instanceof BlockEndNode)) { addForwardEdge(node, node.getNegative()); node.getNegative().accept(this); } node.getSuccessor().accept(this); }
public IfThenElseNode handleIfStatement(Expression condition, List<SequentialNode> then_part, List<SequentialNode> else_part) { IfThenElseNode ifthenelse = new IfThenElseNode(graph, condition); addNode(ifthenelse); rewireNodes(then_part, ifthenelse); rewireNodes(else_part, ifthenelse); ifthenelse.setPositive(then_part.get(0)); ifthenelse.setNegative((else_part != null && else_part.size() > 0) ? else_part.get(0) : new BlockEndNode(graph, lastNode)); return ifthenelse; }
/** * {@inheritDoc} * * This empty implementation visits the positive part, the negative part and finally the successor node by default. */ @Override public void visit(IfThenElseNode node) { node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
@Override public IfThenElseNode copyElements() { IfThenElseNode copy = new IfThenElseNode(getGraph(), condition.copy()); copy.elseif = elseif; SequentialNode newPositive = positive.copy(); newPositive.removePredecessor(this); newPositive.addPredecessor(copy); copy.setPositive(newPositive); copySubtree(newPositive, copy); SequentialNode newNegative = negative.copy(); newNegative.removePredecessor(this); newNegative.addPredecessor(copy); copy.setNegative(newNegative); copySubtree(newNegative, copy); return copy; }
@Override public void replaceSuccessor(Node oldSuccessor, Node newSuccessor) { if (oldSuccessor == positive) { newSuccessor.removePredecessor(oldSuccessor); newSuccessor.addPredecessor(this); // cast is safe since branch of if-then-else cannot be the end node setPositive((SequentialNode) newSuccessor); } else if (oldSuccessor == negative) { newSuccessor.removePredecessor(oldSuccessor); newSuccessor.addPredecessor(this); // cast is safe since branch of if-then-else cannot be the end node setNegative((SequentialNode) newSuccessor); } else { super.replaceSuccessor(oldSuccessor, newSuccessor); } }
@Override public void visit(IfThenElseNode node) { node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { code.append("\\text{IF } ("); node.getCondition().accept(this); code.append(") \\\\\n"); node.getPositive().accept(this); if (!(node.getNegative() instanceof BlockEndNode)) { code.append("\\text{ELSE} \\\\\n"); node.getNegative().accept(this); } code.append("\\text{END IF} \\\\\n"); node.getSuccessor().accept(this); }
/** * {@inheritDoc} * * This empty implementation visits the positive part, the negative part and finally the successor node by default. */ @Override public void visit(IfThenElseNode node) { node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override //cfg public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
/** * Handles an if statement. The statement consists of a condition expression, a mandatory then part (block) and an * optional else part. * * @param condition condition expression * @param then_part list of statements belonging to then part * @param else_part optional list of statements belonging to else part (empty list in case of no else part) * @return new {@link IfThenElseNode} representing this statement. */ public IfThenElseNode handleIfStatement(Expression condition, List<SequentialNode> then_part, List<SequentialNode> else_part) { IfThenElseNode ifthenelse = new IfThenElseNode(graph, condition); addNode(ifthenelse); rewireNodes(then_part, ifthenelse); rewireNodes(else_part, ifthenelse); ifthenelse.setPositive(then_part.get(0)); ifthenelse.setNegative((else_part != null && else_part.size() > 0) ? else_part.get(0) : new BlockEndNode(graph, ifthenelse)); return ifthenelse; }
@Override public void visit(IfThenElseNode node) { findUndeclaredVariables(node.getCondition()); node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { findUndeclaredVariables(node.getCondition()); node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { // just do nothing, because only MulitvectorComponent is important node.getCondition().accept(this); node.getPositive().accept(this); node.getNegative().accept(this); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { appendIndent(); code.append("if ("); code.append(node.getCondition()); code.append(") {\n"); indent++; node.getPositive().accept(this); indent--; appendIndent(); code.append("} else {"); indent++; node.getNegative().accept(this); indent--; appendIndent(); code.append("}\n"); node.getSuccessor().accept(this); }
@Override public void visit(IfThenElseNode node) { node.getSuccessor().accept(this); }