boolean (Statement statement, Set<? super Integer> setReorderedIfs) { if (statement.type != StatementType.IF && statement.type != StatementType.SEQUENCE) { return false; } boolean res = false; while (true) { boolean updated = false; List<Statement> lst = new ArrayList<>(); if (statement.type == StatementType.IF) { lst.add(statement); } else { lst.addAll(statement.getStats()); } boolean stsingle = (lst.size() == 1); for (Statement stat : lst) { if (stat.type == StatementType.IF) { IfNode rtnode = buildGraph((IfStatement)stat, stsingle); if (rtnode == null) { continue; } if (collapseIfIf(rtnode)) { updated = true; break; } if (!setReorderedIfs.contains(stat.id)) { if (collapseIfElse(rtnode)) { updated = true; break; } if (collapseElse(rtnode)) { updated = true; break; } } if (reorderIf((IfStatement)stat)) { updated = true; setReorderedIfs.add(stat.id); break; } } } if (!updated) { break; } res = true; } return res; }