X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Frhynodge%2Fwebpages%2Fweather%2Fwettercom%2FWindDirection.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Frhynodge%2Fwebpages%2Fweather%2Fwettercom%2FWindDirection.kt;h=6335fe26481a194cbc622ec669d53644da47c624;hb=3ad80850a756b85b9cab839d006ab104e01b61d5;hp=0000000000000000000000000000000000000000;hpb=2330b650352517b47d1c6aa0dc054f6d29164157;p=rhynodge.git diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt new file mode 100644 index 0000000..6335fe2 --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt @@ -0,0 +1,34 @@ +package net.pterodactylus.rhynodge.webpages.weather.wettercom + +/** + * The direction the wind comes from. + * + * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net) + */ +enum class WindDirection { + + NONE, + NORTH, + NORTHEAST, + EAST, + SOUTHEAST, + SOUTH, + SOUTHWEST, + WEST, + NORTHWEST + +} + +fun String.toWindDirection(): WindDirection { + return when (this) { + "N" -> WindDirection.NORTH + "NE" -> WindDirection.NORTHEAST + "E" -> WindDirection.EAST + "SE" -> WindDirection.SOUTHEAST + "S" -> WindDirection.SOUTH + "SW" -> WindDirection.SOUTHWEST + "W" -> WindDirection.WEST + "NW" -> WindDirection.NORTHWEST + else -> WindDirection.NONE + } +}