|
|
@@ -1,52 +0,0 @@
|
|
|
-package org.leumasjaffe.recipe.model;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
-
|
|
|
-import org.leumasjaffe.container.Pair;
|
|
|
-
|
|
|
-import lombok.Data;
|
|
|
-
|
|
|
-@Data
|
|
|
-public class Product implements CompoundRecipeComponent {
|
|
|
- @Data
|
|
|
- public static class Phase implements CompoundRecipeComponent {
|
|
|
- List<Step> steps = new ArrayList<>();
|
|
|
-
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
- @Override
|
|
|
- public Collection<RecipeComponent> getComponents() {
|
|
|
- return (Collection<RecipeComponent>)(List<?>) steps;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Data
|
|
|
- public static class RecipePhase {
|
|
|
- List<Pair<Phase, Rest>> additionalPhases = new ArrayList<>();
|
|
|
- Phase phase;
|
|
|
- Optional<Rest> rest = Optional.empty();
|
|
|
-
|
|
|
- void addComponents(Collection<RecipeComponent> comps) {
|
|
|
- additionalPhases.forEach(pair -> {
|
|
|
- comps.add(pair.getLeft());
|
|
|
- comps.add(pair.getRight());
|
|
|
- });
|
|
|
- comps.add(phase);
|
|
|
- rest.ifPresent(comps::add);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- String name;
|
|
|
- RecipePhase prep;
|
|
|
- RecipePhase cooking;
|
|
|
-
|
|
|
- @Override
|
|
|
- public Collection<RecipeComponent> getComponents() {
|
|
|
- Collection<RecipeComponent> comps = new ArrayList<>();
|
|
|
- prep.addComponents(comps);
|
|
|
- cooking.addComponents(comps);
|
|
|
- return comps;
|
|
|
- }
|
|
|
-}
|