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 java.util.Calendar;
18 * Extends the zodiac with a date range.
20 * @author Gerhard Riegler - Initial contribution
22 public class SunZodiac extends Zodiac {
26 * Creates a Zodiac with a sign and a range.
28 public SunZodiac(ZodiacSign sign, Range range) {
34 * Returns she start of the zodiac.
36 public Calendar getStart() {
37 return range == null ? null : range.getStart();
41 * Returns the end of the zodiac.
43 public Calendar getEnd() {
44 return range == null ? null : range.getEnd();
48 * Returns true, if the zodiac is valid on the specified calendar object.
50 public boolean isValid(Calendar calendar) {
51 if (range == null || range.getStart() == null || range.getEnd() == null) {
55 return range.getStart().getTimeInMillis() <= calendar.getTimeInMillis()
56 && range.getEnd().getTimeInMillis() >= calendar.getTimeInMillis();