};
}
@Override
public Cfg getNewSubgraph() {
Cfg newSubgraph = new Cfg();
CfgNode<?> newNode = new CfgNopNode(node.getParent(), node.getJNode());
newSubgraph.addNode(newNode);
// Add all incoming edges.
for (int i = 0; i < graph.getInEdges(node).size(); ++i) {
CfgEdge edge = new CfgEdge();
newSubgraph.addIn(newNode, edge);
newSubgraph.addGraphInEdge(edge);
}
for (CfgEdge e : graph.getOutEdges(node)) {
CfgEdge edge = new CfgEdge(e.getRole());
newSubgraph.addGraphOutEdge(edge);
if (e.getRole() != null
&& ((e.getRole().equals(CfgConditionalNode.ELSE) && conditionValue) ||
(e.getRole().equals(CfgConditionalNode.THEN) && !conditionValue))) {
// Do not connect this edge due to constant condition.
} else {
newSubgraph.addOut(newNode, edge);
}
}
return newSubgraph;
}