classDiagram
title Previsao do Tempo - Principais Classes
class Main {
}
namespace Providers {
class ProviderHistoryApi {
+fetch(String location)
}
class ProviderKelvinApi {
+fetch(String location)
}
}
class Weather {
+location : String
+temperatureCelsius : double
+humidity : double
+windForce : double
+windDirection : String
}
class KelvinPayload {
+city : String
+temperatureKelvin : double
+humidity : double
+windX : double
+windY : double
}
class HistoryPayload {
+city : String
+lastFiveTemperatures : double[]
+humidity : double
+windForce : double
+windDirectionDegrees : double
}
class WeatherUtils {
+vectorToCardinal(double x, double y) : double
+vectorMagnitude(double x, double y) : double
+degreesToCardinal(double degrees) : String
}
Main ..> ProviderHistoryApi : chama
Main ..> ProviderKelvinApi : chama
Main ..> Weather : cria
Main ..> WeatherUtils : usa
ProviderHistoryApi ..> HistoryPayload : payload
ProviderKelvinApi ..> KelvinPayload : payload
classDiagram
title Adapter Pattern
class Main {
}
namespace Providers {
class ProviderHistoryApi {
+fetch(String location)
}
class ProviderKelvinApi {
+fetch(String location)
}
}
namespace Adapters {
class WeatherProviderAdapter {
<<interface>>
+getCurrentWeather(String location) Weather
}
class HistoryProviderAdapter {
+getCurrentWeather(String location) Weather
}
class KelvinProviderAdapter {
+getCurrentWeather(String location) Weather
}
}
class Weather {
+location : String
+temperatureCelsius : double
+humidity : double
+windForce : double
+windDirection : String
}
class WeatherUtils {
+vectorToCardinal(double x, double y) : double
+vectorMagnitude(double x, double y) : double
+degreesToCardinal(double degrees) : String
}
%% Relationships
Main ..> WeatherUtils : usa
Main --> WeatherProviderAdapter : usa
WeatherProviderAdapter <|.. HistoryProviderAdapter : implementa
WeatherProviderAdapter <|.. KelvinProviderAdapter : implementa
HistoryProviderAdapter ..> ProviderHistoryApi : chama
KelvinProviderAdapter ..> ProviderKelvinApi : chama
WeatherProviderAdapter ..> Weather : retorna
classDiagram
title Adapter Pattern
class Main {
}
class WeatherCollection {
+toString() : String
+saveToTextFile(String filename) : void
+items : List<Weather>
}
class Weather {
+location : String
+temperatureCelsius : double
+humidity : double
+windForce : double
+windDirection : String
}
%% Relationships
Main ..> WeatherCollection : cria
WeatherCollection ..> Weather : contém
classDiagram
title Adapter Pattern
class Main {
}
class WeatherCollection {
+toString() : String
+saveToTextFile(String filename) : void
+items : List<Weather>
}
class Weather {
+location : String
+temperatureCelsius : double
+humidity : double
+windForce : double
+windDirection : String
}
class WeatherPage {
+renderer : WeatherRenderer
+display() void
}
namespace Renderers {
class WeatherRenderer {
<<interface>>
+getCurrentWeather(String location) Weather
}
class ConsoleRenderer {
+renderCollection(WeatherCollection collection) void
}
class TextFileRenderer {
+filePath : String
+renderCollection(WeatherCollection collection) void
}
}
%% Relationships
Main ..> WeatherPage : cria
WeatherPage ..> WeatherCollection : renderiza
WeatherCollection ..> Weather : contém
ConsoleRenderer <|.. WeatherRenderer : implementa
TextFileRenderer <|.. WeatherRenderer : implementa
WeatherRenderer <.. WeatherCollection : usa
classDiagram
title Adapter Pattern
class Main {
}
namespace Providers {
class ProviderHistoryApi {
+fetch(String location)
}
class ProviderKelvinApi {
+fetch(String location)
}
}
namespace Adapters {
class WeatherProviderAdapter {
<<interface>>
+getCurrentWeather(String location) Weather
}
class HistoryProviderAdapter {
+getCurrentWeather(String location) Weather
}
class KelvinProviderAdapter {
+getCurrentWeather(String location) Weather
}
}
class Weather {
+location : String
+temperatureCelsius : double
+humidity : double
+windForce : double
+windDirection : String
}
class WeatherUtils {
+vectorToCardinal(double x, double y) : double
+vectorMagnitude(double x, double y) : double
+degreesToCardinal(double degrees) : String
}
class WeatherCollection {
+toString() : String
+saveToTextFile(String filename) : void
+items : List<Weather>
}
class WeatherPage {
+renderer : WeatherRenderer
+display() void
}
namespace Renderers {
class WeatherRenderer {
<<interface>>
+getCurrentWeather(String location) Weather
}
class ConsoleRenderer {
+renderCollection(WeatherCollection collection) void
}
class TextFileRenderer {
+filePath : String
+renderCollection(WeatherCollection collection) void
}
}
%% Relationships
Main ..> WeatherPage : cria
WeatherPage ..> WeatherCollection : renderiza
WeatherCollection ..> Weather : contém
ConsoleRenderer <|.. WeatherRenderer : implementa
TextFileRenderer <|.. WeatherRenderer : implementa
WeatherRenderer <.. WeatherCollection : usa
WeatherProviderAdapter ..> WeatherUtils : usa
Main --> WeatherProviderAdapter : usa
WeatherProviderAdapter <|.. HistoryProviderAdapter : implementa
WeatherProviderAdapter <|.. KelvinProviderAdapter : implementa
HistoryProviderAdapter ..> ProviderHistoryApi : chama
KelvinProviderAdapter ..> ProviderKelvinApi : chama