]> git.basschouten.com Git - openhab-addons.git/blob
721a9cdab2639e78fb4aae6f9b3b1cf9f952c4ca
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.astro.internal.model;
14
15 import static org.openhab.core.library.unit.MetricPrefix.KILO;
16 import static org.openhab.core.library.unit.SIUnits.METRE;
17
18 import java.util.Calendar;
19
20 import javax.measure.quantity.Length;
21
22 import org.openhab.core.library.types.QuantityType;
23
24 /**
25  * Holds a distance informations.
26  *
27  * @author Gerhard Riegler - Initial contribution
28  * @author Christoph Weitkamp - Introduced UoM
29  */
30 public class MoonDistance {
31
32     private Calendar date;
33     private double distance;
34
35     /**
36      * Returns the date of the calculated distance.
37      */
38     public Calendar getDate() {
39         return date;
40     }
41
42     /**
43      * Sets the date of the calculated distance.
44      */
45     public void setDate(Calendar date) {
46         this.date = date;
47     }
48
49     /**
50      * Returns the distance in kilometers.
51      */
52     public QuantityType<Length> getDistance() {
53         return new QuantityType<>(distance, KILO(METRE));
54     }
55
56     /**
57      * Sets the distance in kilometers.
58      */
59     public void setDistance(double kilometer) {
60         this.distance = kilometer;
61     }
62 }