Move WindDirection to parent package
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 28 May 2016 14:15:35 +0000 (16:15 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 28 May 2016 14:15:35 +0000 (16:15 +0200)
src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WindDirection.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/HourState.kt
src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComFilter.kt
src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WindDirection.kt [deleted file]
src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComFilterTest.kt
src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComStateTest.kt
src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/wettercom/WetterComTriggerTest.kt

diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WindDirection.kt b/src/main/kotlin/net/pterodactylus/rhynodge/webpages/weather/WindDirection.kt
new file mode 100644 (file)
index 0000000..ab8b030
--- /dev/null
@@ -0,0 +1,34 @@
+package net.pterodactylus.rhynodge.webpages.weather
+
+/**
+ * The direction the wind comes from.
+ *
+ * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net)
+ */
+enum class WindDirection(val arrow: String) {
+
+    NONE("↺"),
+    NORTH("↓"),
+    NORTHEAST("↙"),
+    EAST("←"),
+    SOUTHEAST("↖"),
+    SOUTH("↑"),
+    SOUTHWEST("↗"),
+    WEST("→"),
+    NORTHWEST("↘")
+
+}
+
+fun String.toWindDirection(): WindDirection {
+    return when (this) {
+        "N" -> WindDirection.NORTH
+        "NO" -> WindDirection.NORTHEAST
+        "O" -> WindDirection.EAST
+        "SO" -> WindDirection.SOUTHEAST
+        "S" -> WindDirection.SOUTH
+        "SW" -> WindDirection.SOUTHWEST
+        "W" -> WindDirection.WEST
+        "NW" -> WindDirection.NORTHWEST
+        else -> WindDirection.NONE
+    }
+}
index f5ddfc2..cd21a92 100644 (file)
@@ -1,6 +1,7 @@
 package net.pterodactylus.rhynodge.webpages.weather.wettercom
 
 import com.fasterxml.jackson.annotation.JsonProperty
+import net.pterodactylus.rhynodge.webpages.weather.WindDirection
 
 /**
  * Container for weather conditions of a single hour.
index 04f38fa..dc33b65 100644 (file)
@@ -4,6 +4,7 @@ import net.pterodactylus.rhynodge.Filter
 import net.pterodactylus.rhynodge.State
 import net.pterodactylus.rhynodge.states.FailedState
 import net.pterodactylus.rhynodge.states.HtmlState
+import net.pterodactylus.rhynodge.webpages.weather.toWindDirection
 import org.jsoup.nodes.Document
 import org.jsoup.nodes.Element
 import java.time.LocalDateTime
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
deleted file mode 100644 (file)
index f856815..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package net.pterodactylus.rhynodge.webpages.weather.wettercom
-
-/**
- * The direction the wind comes from.
- *
- * @author [David ‘Bombe’ Roden](mailto:bombe@pterodactylus.net)
- */
-enum class WindDirection(val arrow: String) {
-
-    NONE("↺"),
-    NORTH("↓"),
-    NORTHEAST("↙"),
-    EAST("←"),
-    SOUTHEAST("↖"),
-    SOUTH("↑"),
-    SOUTHWEST("↗"),
-    WEST("→"),
-    NORTHWEST("↘")
-
-}
-
-fun String.toWindDirection(): WindDirection {
-    return when (this) {
-        "N" -> WindDirection.NORTH
-        "NO" -> WindDirection.NORTHEAST
-        "O" -> WindDirection.EAST
-        "SO" -> WindDirection.SOUTHEAST
-        "S" -> WindDirection.SOUTH
-        "SW" -> WindDirection.SOUTHWEST
-        "W" -> WindDirection.WEST
-        "NW" -> WindDirection.NORTHWEST
-        else -> WindDirection.NONE
-    }
-}
index aa72f3c..75b471a 100644 (file)
@@ -4,6 +4,7 @@ import net.pterodactylus.rhynodge.State
 import net.pterodactylus.rhynodge.filters.ResourceLoader.loadDocument
 import net.pterodactylus.rhynodge.states.FailedState
 import net.pterodactylus.rhynodge.states.HtmlState
+import net.pterodactylus.rhynodge.webpages.weather.WindDirection
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.`is`
 import org.hamcrest.Matchers.contains
index cdab7b6..93667ea 100644 (file)
@@ -1,6 +1,7 @@
 package net.pterodactylus.rhynodge.webpages.weather.wettercom
 
 import com.fasterxml.jackson.databind.ObjectMapper
+import net.pterodactylus.rhynodge.webpages.weather.WindDirection
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.`is`
 import org.junit.Test
index 2205dbb..5cc3f06 100644 (file)
@@ -1,6 +1,7 @@
 package net.pterodactylus.rhynodge.webpages.weather.wettercom
 
 import net.pterodactylus.rhynodge.Reaction
+import net.pterodactylus.rhynodge.webpages.weather.WindDirection
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.`is`
 import org.hamcrest.Matchers.containsString