]> git.basschouten.com Git - openhab-addons.git/blob
1cb1fb7d746883194ce0bc74dca37995d2fc7ae5
[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.weatherunderground.internal.json;
14
15 import java.util.List;
16
17 /**
18  * The {@link WeatherUndergroundJsonSimpleForecast} is the Java class used
19  * to map the entry "forecast.simpleforecast" from the JSON response
20  * to a Weather Underground request.
21  *
22  * @author Laurent Garnier - Initial contribution
23  */
24 public class WeatherUndergroundJsonSimpleForecast {
25
26     private List<WeatherUndergroundJsonForecastDay> forecastday;
27
28     public WeatherUndergroundJsonSimpleForecast() {
29     }
30
31     /**
32      * Get the {@link WeatherUndergroundJsonForecastDay} object for a given day
33      *
34      * @return the {@link WeatherUndergroundJsonForecastDay} object for the day
35      */
36     public WeatherUndergroundJsonForecastDay getForecastDay(int day) {
37         for (WeatherUndergroundJsonForecastDay forecast : forecastday) {
38             if (forecast.getPeriod().intValue() == day) {
39                 return forecast;
40             }
41         }
42         return null;
43     }
44 }