2 * Copyright (c) 2010-2023 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.astro.internal.model;
15 import static org.openhab.core.library.unit.MetricPrefix.KILO;
16 import static org.openhab.core.library.unit.SIUnits.METRE;
18 import java.util.Calendar;
20 import javax.measure.quantity.Length;
22 import org.openhab.core.library.types.QuantityType;
25 * Holds a distance informations.
27 * @author Gerhard Riegler - Initial contribution
28 * @author Christoph Weitkamp - Introduced UoM
30 public class MoonDistance {
32 private Calendar date;
33 private double distance;
36 * Returns the date of the calculated distance.
38 public Calendar getDate() {
43 * Sets the date of the calculated distance.
45 public void setDate(Calendar date) {
50 * Returns the distance in kilometers.
52 public QuantityType<Length> getDistance() {
53 return new QuantityType<>(distance, KILO(METRE));
57 * Sets the distance in kilometers.
59 public void setDistance(double kilometer) {
60 this.distance = kilometer;