void (Statement stat, HashMap<Statement, List<StatEdge>> mapEdges, Statement next) { StatEdge statedge = null; List<StatEdge> lstSuccs = stat.getAllSuccessorEdges(); if (!lstSuccs.isEmpty()) { statedge = lstSuccs.get(0); if (statedge.getDestination() == next) { statedge.explicit = false; statedge = null; } else { next = statedge.getDestination(); } } // no next for a do statement if (stat.type == StatementType.DO && ((DoStatement)stat).getLoopType() == LoopType.DO) { next = null; } if (next == null) { if (mapEdges.size() == 1) { List<StatEdge> lstEdges = mapEdges.values().iterator().next(); if (lstEdges.size() > 1 && mapEdges.keySet().iterator().next().type != StatementType.DUMMY_EXIT) { StatEdge edge_example = lstEdges.get(0); Statement closure = stat.getParent(); if (!closure.containsStatementStrict(edge_example.closure)) { closure = edge_example.closure; } StatEdge newedge = new StatEdge(edge_example.getType(), stat, edge_example.getDestination(), closure); stat.addSuccessor(newedge); for (StatEdge edge : lstEdges) { edge.explicit = false; } mapEdges.put(newedge.getDestination(), new ArrayList<>(Collections.singletonList(newedge))); } } } else { boolean implfound = false; for (Entry<Statement, List<StatEdge>> entr : mapEdges.entrySet()) { if (entr.getKey() == next) { for (StatEdge edge : entr.getValue()) { edge.explicit = false; } implfound = true; break; } } if (stat.getAllSuccessorEdges().isEmpty() && !implfound) { List<StatEdge> lstEdges = null; for (Entry<Statement, List<StatEdge>> entr : mapEdges.entrySet()) { if (entr.getKey().type != StatementType.DUMMY_EXIT && (lstEdges == null || entr.getValue().size() > lstEdges.size())) { lstEdges = entr.getValue(); } } if (lstEdges != null && lstEdges.size() > 1) { StatEdge edge_example = lstEdges.get(0); Statement closure = stat.getParent(); if (!closure.containsStatementStrict(edge_example.closure)) { closure = edge_example.closure; } StatEdge newedge = new StatEdge(edge_example.getType(), stat, edge_example.getDestination(), closure); stat.addSuccessor(newedge); for (StatEdge edge : lstEdges) { edge.explicit = false; } } } mapEdges.clear(); } if (statedge != null) { mapEdges.put(statedge.getDestination(), new ArrayList<>(Collections.singletonList(statedge))); } }