|
|
@@ -16,7 +16,7 @@ public class Phase extends Observable.Instance implements CompoundRecipeComponen
|
|
|
int id = 0; // TODO Fix this
|
|
|
int[] dependsOn = {}; // decltype(id)[]
|
|
|
String vessel = "";
|
|
|
- Optional<Preparation> preparation = Optional.empty();
|
|
|
+ Preparation preparation = new Preparation();
|
|
|
List<Step> cooking = new ArrayList<>();
|
|
|
Optional<Rest> rest = Optional.empty();
|
|
|
|
|
|
@@ -30,7 +30,8 @@ public class Phase extends Observable.Instance implements CompoundRecipeComponen
|
|
|
}
|
|
|
|
|
|
public CollatedDuration getCollatedDuration() {
|
|
|
- final Duration prep = preparation.map(Preparation::getDuration).orElse(Duration.ZERO);
|
|
|
+ final Duration prep = preparation.getIngredients().isEmpty() ?
|
|
|
+ Duration.ZERO : preparation.getDuration();
|
|
|
final Duration rest = this.rest.map(Rest::getDuration).orElse(Duration.ZERO);
|
|
|
final Duration cooking = this.cooking.stream().map(Step::getDuration)
|
|
|
.reduce(Duration.ZERO, Duration::plus);
|
|
|
@@ -38,6 +39,6 @@ public class Phase extends Observable.Instance implements CompoundRecipeComponen
|
|
|
}
|
|
|
|
|
|
public void setPreparation(final @NonNull Preparation p) {
|
|
|
- preparation = Optional.of(new Preparation(p.duration, this::getIngredients));
|
|
|
+ preparation = new Preparation(p.duration, this::getIngredients);
|
|
|
}
|
|
|
}
|