2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.awattar.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.awattar.internal.handler.TimeRange;
19 * Class to store hourly price data.
21 * @author Wolfgang Klimt - initial contribution
22 * @author Jan N. Klug - Refactored to record
25 public record AwattarPrice(double netPrice, double grossPrice, double netTotal, double grossTotal,
26 TimeRange timerange) implements Comparable<AwattarPrice> {
29 public String toString() {
30 return String.format("(%1$tF %1$tR - %2$tR: %3$.3f)", timerange.start(), timerange.end(), netPrice);
34 public int compareTo(AwattarPrice o) {
35 return Double.compare(netPrice, o.netPrice);