6335fe26481a194cbc622ec669d53644da47c624
[rhynodge.git] / src / main / kotlin / net / pterodactylus / rhynodge / webpages / weather / wettercom / WindDirection.kt
1 package net.pterodactylus.rhynodge.webpages.weather.wettercom
2
3 /**
4  * The direction the wind comes from.
5  *
6  * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net)
7  */
8 enum class WindDirection {
9
10     NONE,
11     NORTH,
12     NORTHEAST,
13     EAST,
14     SOUTHEAST,
15     SOUTH,
16     SOUTHWEST,
17     WEST,
18     NORTHWEST
19
20 }
21
22 fun String.toWindDirection(): WindDirection {
23     return when (this) {
24         "N" -> WindDirection.NORTH
25         "NE" -> WindDirection.NORTHEAST
26         "E" -> WindDirection.EAST
27         "SE" -> WindDirection.SOUTHEAST
28         "S" -> WindDirection.SOUTH
29         "SW" -> WindDirection.SOUTHWEST
30         "W" -> WindDirection.WEST
31         "NW" -> WindDirection.NORTHWEST
32         else -> WindDirection.NONE
33     }
34 }