code clean RuntimeExceptions
This commit is contained in:
parent
dfc374b13a
commit
27d827b9d6
@ -53,7 +53,7 @@ public enum Alignment {
|
|||||||
} else if (this.amount instanceof final Period period) {
|
} else if (this.amount instanceof final Period period) {
|
||||||
return period.multipliedBy((int) amount);
|
return period.multipliedBy((int) amount);
|
||||||
}
|
}
|
||||||
throw new RuntimeException();
|
throw new RuntimeException("Cannot multiply unimplemented TemporalAmount: %s".formatted(this.amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public class GraphPoint {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public GraphPoint plus(@NonNull final GraphPoint other) {
|
public GraphPoint plus(@NonNull final GraphPoint other) {
|
||||||
if (this.date.compareTo(other.date) != 0) {
|
if (this.date.compareTo(other.date) != 0) {
|
||||||
throw new RuntimeException();
|
throw new RuntimeException("Cannot 'add' GraphPoints with different dates: this=%s, other=%s".formatted(this, other));
|
||||||
}
|
}
|
||||||
return new GraphPoint(date, value + other.value);
|
return new GraphPoint(date, value + other.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,10 +31,8 @@ public abstract class MeterValue {
|
|||||||
|
|
||||||
public void update(@NonNull final Value value) {
|
public void update(@NonNull final Value value) {
|
||||||
final double converted = value.as(id.getMeter().getSeries().getUnit()).value;
|
final double converted = value.as(id.getMeter().getSeries().getUnit()).value;
|
||||||
if (converted < this.max) {
|
this.min = Math.min(this.min, converted);
|
||||||
throw new RuntimeException();
|
this.max = Math.max(this.max, converted);
|
||||||
}
|
|
||||||
this.max = converted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user