- boolean tryToCompletePhase(final ModelProcessingPhase phase) {
-
- boolean finished = true;
- final Collection<ContextMutation> openMutations = phaseMutation.get(phase);
- if (!openMutations.isEmpty()) {
- final Iterator<ContextMutation> it = openMutations.iterator();
- while (it.hasNext()) {
- final ContextMutation current = it.next();
- if (current.isFinished()) {
- it.remove();
- } else {
- finished = false;
- }
- }
-
- if (openMutations.isEmpty()) {
- phaseMutation.removeAll(phase);
- if (phaseMutation.isEmpty()) {
- phaseMutation = ImmutableMultimap.of();
- }
- }
+ final boolean tryToCompletePhase(final ModelProcessingPhase phase) {
+ final boolean finished = phaseMutation.isEmpty() ? true : runMutations(phase);
+ if (completeChildren(phase) && finished) {
+ onPhaseCompleted(phase);
+ return true;