Added new improvements

This commit is contained in:
Robert Vokac 2024-02-04 14:47:52 +00:00
parent d3b134586b
commit a32b1f4615
No known key found for this signature in database
GPG Key ID: 693D30BEE3329055
3 changed files with 9 additions and 0 deletions

View File

@ -12,6 +12,9 @@ public class HourBattery extends Battery{
}
public static double getHourProgress(TimeHM timeRemains, int secondsRemains,
int millisecondsRemains) {
if(secondsRemains < 0 || millisecondsRemains < 0 || timeRemains.getHour() < 0 || timeRemains.getMinute() < 0) {
return 1;
}
double minutesRemainsD = timeRemains.getMinute();
double secondsRemainsD = secondsRemains;
double millisecondsRemainsD = millisecondsRemains;

View File

@ -9,6 +9,9 @@ public class MonthBattery extends Battery{
super("Month", x, i, i1);
}
public static double getMonthProgress(int weekDayWhenMondayIsOne, int workDaysDone, int workDaysTotal, double done) {
if(done >1) {
done = 1;
}
return weekDayWhenMondayIsOne == 0
|| weekDayWhenMondayIsOne == 6 ?
workDaysDone / workDaysTotal :

View File

@ -11,6 +11,9 @@ public class WeekBattery extends Battery{
super("Week", x, i, i1);
}
public static double getWeekProgress(int weekDayWhenMondayIsOne, double done) {
if(done >1) {
done = 1;
}
return weekDayWhenMondayIsOne == 0
|| weekDayWhenMondayIsOne == 6 ?
100 : ((weekDayWhenMondayIsOne - 1) * 0.20 + done * 0.20);