Class WeatherForecast
java.lang.Object
cz.krystofcejchan.lite_weather_lib.weather_objects.subparts.forecast.WeatherForecast
public class WeatherForecast extends Object
Weather forecast for today, tomorrow, the day after tomorrow
Data can be separated into hours → 12am, 3am, 6am, 9am, 12pm, 3pm, 6pm, 9pm.
see
Data can be separated into hours → 12am, 3am, 6am, 9am, 12pm, 3pm, 6pm, 9pm.
see
TIME, DAY- Version:
- 17
- Author:
- krystof-cejchan
-
Constructor Summary
Constructors Constructor Description WeatherForecast(String location, DAY[] day, TIME... times)WeatherForecast(String location, DAY day, TIME... times)WeatherForecast(String location, TIME[] times, DAY... days)WeatherForecast(String location, TIME time, DAY... days) -
Method Summary
Modifier and Type Method Description static voidclearSavedForecasts()removes saved forecastsMap<DAY,Map<TIME,ForecastAtHour>>getAllForecastForAllDayAndAllTime()get all possible forecasts for all days and times you provided in the constructorList<ForecastAtHour>getAllSavedForecasts()DAY[]getDays()ForecastAtHourgetForecastFor(DAY day, TIME time)returns forecast for specific day and timeStringgetLocation()TIME[]getTimes()TodaygetToday()TomorrowgetTomorrow()AfterTomorrowgetTomorrowAfter()voidprint()prints current object.toString to the consolestatic voidremovedSavedForecast(ForecastAtHour forecast)removes forecast from paramStringtoString()
-
Constructor Details
-
WeatherForecast
public WeatherForecast(@NotNull String location, @NotNull TIME time, @NotNull DAY... days) throws IOException- Throws:
IOException
-
WeatherForecast
public WeatherForecast(@NotNull String location, @NotNull DAY day, @NotNull TIME... times) throws IOException- Throws:
IOException
-
WeatherForecast
public WeatherForecast(@NotNull String location, @NotNull DAY[] day, @NotNull TIME... times) throws IOException- Throws:
IOException
-
WeatherForecast
public WeatherForecast(@NotNull String location, @NotNull TIME[] times, @NotNull DAY... days) throws IOException- Throws:
IOException
-
-
Method Details
-
clearSavedForecasts
public static void clearSavedForecasts()removes saved forecasts -
removedSavedForecast
removes forecast from param- Parameters:
forecast- to be removed
-
getForecastFor
public ForecastAtHour getForecastFor(@NotNull DAY day, @NotNull TIME time) throws NoDataFoundForThisDayAndTimereturns forecast for specific day and time- Parameters:
day-DAYfor which you want to know the forecasttime-TIMEfor which you want to know the forecast- Returns:
- ForecastAtHour for provided DAY and TIME
- Throws:
NoDataFoundForThisDayAndTime- if you did not include day and time when creating constructor
-
getAllForecastForAllDayAndAllTime
get all possible forecasts for all days and times you provided in the constructor- Returns:
- a map of
DAYand map ofTIMEandForecastAtHour
-
getToday
- Returns:
- object containing all weather data for today
- Throws:
NoDataFoundForThisDay- if you did not include this day in constructor
-
getTomorrow
- Returns:
- object containing all weather data for tomorrow
- Throws:
NoDataFoundForThisDay- if you did not include this day in constructor
-
getTomorrowAfter
- Returns:
- object containing all weather data for the day after tomorrow
- Throws:
NoDataFoundForThisDay- if you did not include this day in constructor
-
getDays
- Returns:
- DAYs provided in constructor
-
getTimes
- Returns:
- TIMEs provided in constructor
-
getLocation
- Returns:
- location provided in the constructor of this class or its parent class
if you need to get more detailed information, useNearestArea
-
getAllSavedForecasts
- Returns:
- all saved forecasts
-
print
public void print()prints current object.toString to the console -
toString
- Overrides:
toStringin classObject- Returns:
- object to string, modified to prevent
NullPointerExceptionif class fields are null
-