Java 17 features (A-G) (#15516)
- add missing @override - Java style array syntax - remove redundant modifiers - always move String constants to left side in comparisons - simplify lambda expressions and return statements - use replace instead of replaceAll w/o regex - instanceof matching and multiline strings Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
@@ -27,6 +27,7 @@ public class AwattarBestpriceConfiguration {
|
||||
public int length;
|
||||
public boolean consecutive;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("{ s: %d, d: %d, l: %d, c: %b )", rangeStart, rangeDuration, length, consecutive);
|
||||
}
|
||||
|
||||
@@ -66,11 +66,13 @@ public class AwattarConsecutiveBestPriceResult extends AwattarBestPriceResult {
|
||||
return priceSum;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("{%s, %s, %.2f}", formatDate(getStart(), zoneId), formatDate(getEnd(), zoneId),
|
||||
priceSum / length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHours() {
|
||||
return hours;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class AwattarNonConsecutiveBestPriceResult extends AwattarBestPriceResult
|
||||
return members.stream().anyMatch(x -> x.contains(Instant.now().toEpochMilli()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("NonConsecutiveBestpriceResult with %s", members.toString());
|
||||
}
|
||||
@@ -67,6 +68,7 @@ public class AwattarNonConsecutiveBestPriceResult extends AwattarBestPriceResult
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHours() {
|
||||
boolean second = false;
|
||||
sort();
|
||||
|
||||
@@ -50,6 +50,7 @@ public class AwattarPrice implements Comparable<AwattarPrice> {
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("(%1$tF %1$tR - %2$tR: %3$.3f)", startTimestamp, endTimestamp, getPrice());
|
||||
}
|
||||
|
||||
@@ -40,9 +40,7 @@ public class AwattarUtil {
|
||||
int offset = min % mod;
|
||||
offset = offset == 0 ? mod : offset;
|
||||
dt = dt.plusMinutes(offset);
|
||||
long result = dt.toInstant().toEpochMilli() - now;
|
||||
|
||||
return result;
|
||||
return dt.toInstant().toEpochMilli() - now;
|
||||
}
|
||||
|
||||
public static ZonedDateTime getCalendarForHour(int hour, ZoneId zone) {
|
||||
|
||||
@@ -97,6 +97,7 @@ public class AwattarPriceHandler extends BaseThingHandler {
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
ScheduledFuture<?> localRefresher = thingRefresher;
|
||||
if (localRefresher != null) {
|
||||
|
||||
Reference in New Issue
Block a user