feat(client/scaling): initial implementation
This commit is contained in:
parent
2a4b6d3fce
commit
54db9bddff
4 changed files with 96 additions and 5 deletions
|
|
@ -191,5 +191,14 @@ public class Recipe {
|
|||
", preparationSteps=" + preparationSteps +
|
||||
'}';
|
||||
}
|
||||
public static Recipe getScaled(Recipe recipe, Double scale) {
|
||||
List<RecipeIngredient> i = recipe.getIngredients().stream().map(ri -> switch (ri) {
|
||||
case FormalIngredient f -> f.scaleBy(scale);
|
||||
case VagueIngredient v -> v;
|
||||
default -> throw new IllegalStateException("Unexpected value: " + ri);
|
||||
}).toList();
|
||||
return new Recipe(recipe.getId(), recipe.getName(), recipe.getLocale(), i, recipe.getPreparationSteps());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue