Data/src/main/java/de/ph87/data/series/graph/GraphPoint.java

23 lines
485 B
Java

package de.ph87.data.series.graph;
import lombok.*;
import java.time.*;
@Data
public class GraphPoint {
public final ZonedDateTime date;
public final double value;
@NonNull
public GraphPoint plus(@NonNull final GraphPoint other) {
if (this.date.compareTo(other.date) != 0) {
throw new RuntimeException("Cannot 'add' GraphPoints with different dates: this=%s, other=%s".formatted(this, other));
}
return new GraphPoint(date, value + other.value);
}
}