feat: udpate diagram_class.puml and use svg instead of png
This commit is contained in:
parent
3067e47dc6
commit
c205409347
1
Weather_App.svg
Normal file
1
Weather_App.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 48 KiB |
@ -1 +1,130 @@
|
|||||||
@startuml
title Weather App
note "Getters, setters and constructors are not displayed" as N
package eirb.pg203 {
Interface WeatherDataAPI {
+ WeatherData getTemperature(int day, String city)
+ WeatherData getTemperature(int day, int hour, String city)
+ WeatherData getTemperatures(int days, String city)
+ String getAPIName()
}
Interface WeatherDisplay {
+ void display(int days, String city)
+ void addAPI(WeatherDataAPI w)
}
Exception exceptions.WeatherFeatchingException {
}
Exception exceptions.WeatherFeatchingExceptionApi extends exceptions.WeatherFeatchingException{
}
Exception exceptions.WeatherFeatchingExceptionCityCoords extends exceptions.WeatherFeatchingException{
}
Class utils.Coords {
- float lat
- float lon
}
Class utils.JSONFetcher {
+ fetch(URL url)
- private {static} fetchString(URL url)
}
Class City {
- String cityName
- utils.Coords cityCoords
~ JSONFetcher JSONFetcher
- private Coords getCoordsFromName(String cityName)
+ public String toString()
}
Class WeatherData {
- City city
- Instant date
- float temp
- Condition condition
- float windSpeed
- float windDirectionAngle
- WindDirection windDirection
+ String toString()
}
Class WeatherDisplayBasic implements WeatherDisplay {
- ArrayList<WeatherDataAPI> apis
- double getColumnSize()
- void displayHeader(int days, double sourceColumnSize, double dayColumnSize)
- void displayWeatherDatas(String apiName, ArrayList<WeatherData> weatherDatas, String startColumnSize, double sourceColumnSize, double dayColumnSize)
- void displaySeparatorLine(int days, double sourceColumnSize, double dayColumnSize)
- void displayAllWeatherDatas()
}
Class OpenMeteo implements WeatherDataAPI {
- String {final} forecastBaseUrl
- String {final} daylyQuery
~ JSONFetcher JSONFetcher
~ Clock clock
- JSONObject fetchWeather(int days, City city)
- Condition {static} getConditionFromCode(int WMOCode)
- WeatherData getWeatherDataFromForecast(JSONObject response, int day, String city)
}
Class OpenWeatherMap implements WeatherDataAPI {
- String {static} forecastBaseUrl
- String APIKey
~ Clock clock
~ JSONFetcher JSONFetcher
- WeatherData getWeatherDataFromForecast(JSONObject response, int day, String city)
- JSONObject fetchWeather(City city)
}
Class WeatherAPI implements WeatherDataAPI {
- String APIKey
- String {static} forecastBaseUrl
~ JSONFetcher JSONFetcher
- JSONObject fetchWeather(int days, String city)
- WeatherData.Condition {static} getConditionFromString(String str)
- WeatherData {static} getWeatherDataFromForecast(JSONObject response, int day, String city)
}
}
Exception Exception
Exception <|-- WeatherFeatchingException
@enduml
|
@startuml
|
||||||
|
|
||||||
|
title Weather App
|
||||||
|
|
||||||
|
note "Getters, setters and constructors are not displayed" as N
|
||||||
|
|
||||||
|
package eirb.pg203.weather {
|
||||||
|
|
||||||
|
package data {
|
||||||
|
package api {
|
||||||
|
Interface WeatherDataAPI {
|
||||||
|
+ ArrayList<WeatherData> getTemperature(int day, String city)
|
||||||
|
+ ArrayList<WeatherData> getTemperature(int day, int hour, String city)
|
||||||
|
+ ArrayList<WeatherData> getTemperatures(int days, String city)
|
||||||
|
+ String getAPIName()
|
||||||
|
}
|
||||||
|
|
||||||
|
class WeatherDataCache {
|
||||||
|
+ private HashMap<String,WeatherDataCache.CacheValue> {final} cache
|
||||||
|
+ private long {static} {final} cacheTTL
|
||||||
|
+ boolean has(String cityName, int day)
|
||||||
|
+ boolean needsUpdate(String cityName, int day)
|
||||||
|
+ void set(String cityName, int day, WeatherData value, Instant timestamp)
|
||||||
|
+ JSONArray toJSON(String apiName)
|
||||||
|
+ void fromJSON(JSONArray data)
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class WeatherCachedAPI implements WeatherDataAPI {
|
||||||
|
~ WeatherDataCache {final} cache
|
||||||
|
+ JSONArray toJSON()
|
||||||
|
+ void loadCache(JSONArray data)
|
||||||
|
+ void loadCacheFromFile(String path)
|
||||||
|
+ void saveCacheToFile(String path)
|
||||||
|
+ ArrayList<WeatherData> getTemperature(JSONArray data)
|
||||||
|
}
|
||||||
|
|
||||||
|
Class OpenMeteo extends WeatherCachedAPI {
|
||||||
|
- String {final} forecastBaseUrl
|
||||||
|
- String {final} daylyQuery
|
||||||
|
~ JSONFetcher JSONFetcher
|
||||||
|
~ Clock clock
|
||||||
|
- JSONObject fetchWeather(int days, City city)
|
||||||
|
- Condition {static} getConditionFromCode(int WMOCode)
|
||||||
|
- WeatherData getWeatherDataFromForecast(JSONObject response, int day, String city)
|
||||||
|
}
|
||||||
|
|
||||||
|
Class OpenWeatherMap extends WeatherCachedAPI {
|
||||||
|
- String {static} forecastBaseUrl
|
||||||
|
- String APIKey
|
||||||
|
~ Clock clock
|
||||||
|
~ JSONFetcher JSONFetcher
|
||||||
|
|
||||||
|
- WeatherData getWeatherDataFromForecast(JSONObject response, int day, String city)
|
||||||
|
- JSONObject fetchWeather(City city)
|
||||||
|
}
|
||||||
|
|
||||||
|
Class WeatherAPI extends WeatherCachedAPI {
|
||||||
|
- String APIKey
|
||||||
|
- String {static} forecastBaseUrl
|
||||||
|
~ JSONFetcher JSONFetcher
|
||||||
|
|
||||||
|
- JSONObject fetchWeather(int days, String city)
|
||||||
|
- WeatherData.Condition {static} getConditionFromString(String str)
|
||||||
|
- WeatherData {static} getWeatherDataFromForecast(JSONObject response, int day, String city)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Class WeatherData {
|
||||||
|
- City city
|
||||||
|
- Instant date
|
||||||
|
- float temp
|
||||||
|
- Condition condition
|
||||||
|
- float windSpeed
|
||||||
|
- float windDirectionAngle
|
||||||
|
- WindDirection windDirection
|
||||||
|
|
||||||
|
+ String toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package display {
|
||||||
|
Class WeatherDisplayBasic implements WeatherDisplay {
|
||||||
|
- ArrayList<WeatherDataAPI> apis
|
||||||
|
|
||||||
|
- double getColumnSize()
|
||||||
|
- void displayHeader(int days, double sourceColumnSize, double dayColumnSize)
|
||||||
|
- void displayWeatherDatas(String apiName, ArrayList<WeatherData> weatherDatas, String startColumnSize, double sourceColumnSize, double dayColumnSize)
|
||||||
|
- void displaySeparatorLine(int days, double sourceColumnSize, double dayColumnSize)
|
||||||
|
- void displayAllWeatherDatas()
|
||||||
|
}
|
||||||
|
|
||||||
|
Interface WeatherDisplay {
|
||||||
|
+ void display(int days, String city)
|
||||||
|
+ void addAPI(WeatherDataAPI w)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package exceptions {
|
||||||
|
Exception WeatherFeatchingException {}
|
||||||
|
Exception WeatherFeatchingExceptionApi extends WeatherFeatchingException{}
|
||||||
|
Exception WeatherFeatchingExceptionCityCoords extends WeatherFeatchingException{}
|
||||||
|
}
|
||||||
|
|
||||||
|
package utils {
|
||||||
|
Class utils.Coords {
|
||||||
|
- float lat
|
||||||
|
- float lon
|
||||||
|
}
|
||||||
|
|
||||||
|
Class utils.JSONFetcher {
|
||||||
|
+ fetch(URL url)
|
||||||
|
- private {static} fetchString(URL url)
|
||||||
|
}
|
||||||
|
|
||||||
|
Class City {
|
||||||
|
- String cityName
|
||||||
|
- utils.Coords cityCoords
|
||||||
|
~ JSONFetcher JSONFetcher
|
||||||
|
|
||||||
|
- private Coords getCoordsFromName(String cityName)
|
||||||
|
+ public String toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Exception Exception
|
||||||
|
Exception <|-- WeatherFeatchingException
|
||||||
|
WeatherDataCache "1" *-left- "1" WeatherCachedAPI
|
||||||
|
@enduml
|
||||||
|
BIN
weather-app.png
BIN
weather-app.png
Binary file not shown.
Before Width: | Height: | Size: 159 KiB |
Loading…
x
Reference in New Issue
Block a user