improve readability
This commit is contained in:
@@ -77,8 +77,7 @@ public class LoadingBar {
|
||||
private static void askParametersAndRun() throws IOException {
|
||||
var br = new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
|
||||
print("Ankunftszeit: ");
|
||||
String startTimeRaw = br.readLine();
|
||||
var startTime = LocalTime.parse(startTimeRaw, TIME_FORMATTER).truncatedTo(ChronoUnit.MINUTES);
|
||||
var startTime = LocalTime.parse(br.readLine(), TIME_FORMATTER).truncatedTo(ChronoUnit.MINUTES);
|
||||
handleMittagspause(br, startTime);
|
||||
handleZapfenstreich(br, startTime);
|
||||
}
|
||||
@@ -422,8 +421,9 @@ public class LoadingBar {
|
||||
private static String fillLoadingBar(long totalMinutes, long passedMinutes, boolean progressive) {
|
||||
var nonNegativePassedMinutes = passedMinutes < 0 ? 0 : passedMinutes;
|
||||
BigDecimal wholePercentage = BigDecimal.valueOf(100)
|
||||
.multiply( // kind of reverse dreisatz to avoid to have e.g. 99.9999 instead of 100 %
|
||||
BigDecimal.valueOf(nonNegativePassedMinutes).divide(BigDecimal.valueOf(totalMinutes), MathContext.DECIMAL64));
|
||||
// kind of reverse dreisatz to avoid having e.g. 99.9999 instead of 100 %
|
||||
.multiply(BigDecimal.valueOf(nonNegativePassedMinutes))
|
||||
.divide(BigDecimal.valueOf(totalMinutes), MathContext.DECIMAL64);
|
||||
int numberOfEquals = wholePercentage.intValue();
|
||||
var sb = new StringBuilder("[");
|
||||
for (int i = 0; i < LINE_LENGTH; i++) {
|
||||
|
Reference in New Issue
Block a user