fix: getting to it
This commit is contained in:
parent
72f29467bd
commit
3a0120dc33
4 changed files with 8 additions and 8 deletions
|
|
@ -78,13 +78,13 @@ public class FormalIngredient extends RecipeIngredient implements Scalable<Forma
|
|||
}
|
||||
|
||||
@Override
|
||||
public double kcal() {
|
||||
public double getKcal() {
|
||||
final double PER_GRAMS = 100;
|
||||
return ingredient.kcalPer100g() * amountInBaseUnit() / PER_GRAMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double amount() {
|
||||
public double getBaseAmount() {
|
||||
return amountInBaseUnit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ public class Recipe {
|
|||
public double kcal() {
|
||||
final double PER = 100; // Gram
|
||||
return
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::kcal).sum() /
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::amount).sum() * PER;
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::getKcal).sum() /
|
||||
this.ingredients.stream().mapToDouble(RecipeIngredient::getBaseAmount).sum() * PER;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -92,6 +92,6 @@ public abstract class RecipeIngredient {
|
|||
public int hashCode() {
|
||||
return Objects.hash(id, ingredient);
|
||||
}
|
||||
public abstract double kcal();
|
||||
public abstract double amount();
|
||||
public abstract double getKcal();
|
||||
public abstract double getBaseAmount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ public class VagueIngredient extends RecipeIngredient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public double kcal() {
|
||||
public double getKcal() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public double amount() {
|
||||
public double getBaseAmount() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue