BD suffix not needed anymore

This commit is contained in:
2025-08-08 14:10:19 +02:00
parent 853beb07d2
commit 23d73ee19d

View File

@@ -27,12 +27,12 @@ public class DrinkingBar extends AbstractLoadingBar {
private static final BigDecimal QUARTER_LITRE = BigDecimal.valueOf(0.25); private static final BigDecimal QUARTER_LITRE = BigDecimal.valueOf(0.25);
private static final DecimalFormat LITER_FORMAT = new DecimalFormat("0.00"); private static final DecimalFormat LITER_FORMAT = new DecimalFormat("0.00");
private BigDecimal totalLitresBD; private BigDecimal totalLitres;
protected DrinkingBar(LocalTime startTime) { protected DrinkingBar(LocalTime startTime) {
super(startTime, DEFAULT_TOTAL_TIME); super(startTime, DEFAULT_TOTAL_TIME);
this.totalLitresBD = DEFAULT_TOTAL_LITRES; this.totalLitres = DEFAULT_TOTAL_LITRES;
} }
@@ -49,7 +49,7 @@ public class DrinkingBar extends AbstractLoadingBar {
calcTotalLitres = calcTotalLitres.subtract(QUARTER_LITRE); calcTotalLitres = calcTotalLitres.subtract(QUARTER_LITRE);
} while (calcTotalLitres.compareTo(totalLitresFromMinutes) >= 0); } while (calcTotalLitres.compareTo(totalLitresFromMinutes) >= 0);
// add quarter since we always did a step "too many", due to the do ... while loop // add quarter since we always did a step "too many", due to the do ... while loop
this.totalLitresBD = calcTotalLitres.add(QUARTER_LITRE); this.totalLitres = calcTotalLitres.add(QUARTER_LITRE);
} }
@@ -69,7 +69,7 @@ public class DrinkingBar extends AbstractLoadingBar {
effectivePassedMinutes = MINUTES_BEFORE_PAUSE; effectivePassedMinutes = MINUTES_BEFORE_PAUSE;
} }
var effectivePassedMinutesBD = BigDecimal.valueOf(effectivePassedMinutes); var effectivePassedMinutesBD = BigDecimal.valueOf(effectivePassedMinutes);
BigDecimal currentLitres = totalLitresBD BigDecimal currentLitres = totalLitres
.multiply(effectivePassedMinutesBD) // reverse dreisatz .multiply(effectivePassedMinutesBD) // reverse dreisatz
.divide(getTotalMinutesBD(), MathContext.DECIMAL64) .divide(getTotalMinutesBD(), MathContext.DECIMAL64)
.add(QUARTER_LITRE); .add(QUARTER_LITRE);
@@ -89,7 +89,7 @@ public class DrinkingBar extends AbstractLoadingBar {
// berechne Liter benötigt bis zum nächsten 0.25er Schritt // berechne Liter benötigt bis zum nächsten 0.25er Schritt
BigDecimal litresToNextStep = QUARTER_LITRE.subtract(currentLitres.remainder(QUARTER_LITRE)); BigDecimal litresToNextStep = QUARTER_LITRE.subtract(currentLitres.remainder(QUARTER_LITRE));
// berechne Minuten benötigt für 1 Liter // berechne Minuten benötigt für 1 Liter
BigDecimal minutesPerLitre = getTotalMinutesBD().divide(totalLitresBD); BigDecimal minutesPerLitre = getTotalMinutesBD().divide(totalLitres);
// berechne Minuten benötigt bis zum nächsten 0.25er Schritt // berechne Minuten benötigt bis zum nächsten 0.25er Schritt
return minutesPerLitre.multiply(litresToNextStep).setScale(0, RoundingMode.HALF_EVEN); return minutesPerLitre.multiply(litresToNextStep).setScale(0, RoundingMode.HALF_EVEN);
} }