fix(commons/scaling): delegate scaleBy(int) to scaleBy(double) impl
This commit is contained in:
parent
b60284fa14
commit
39b2bb9d61
2 changed files with 4 additions and 7 deletions
|
|
@ -52,14 +52,9 @@ public class FormalIngredient extends RecipeIngredient implements Scalable<Forma
|
|||
return amount + unitSuffix + " of " + ingredient.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormalIngredient scaleBy(int numPortions) {
|
||||
return new FormalIngredient(getIngredient(), amount * numPortions, unitSuffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FormalIngredient scaleBy(double factor) {
|
||||
return new FormalIngredient(getIngredient(), amount, unitSuffix);
|
||||
return new FormalIngredient(getIngredient(), amount * factor, unitSuffix);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package commons;
|
||||
|
||||
public interface Scalable<IngredientType extends RecipeIngredient> {
|
||||
IngredientType scaleBy(int numPortions);
|
||||
default IngredientType scaleBy(int numPortions) {
|
||||
return scaleBy((double) numPortions);
|
||||
};
|
||||
IngredientType scaleBy(double factor);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue