From 15c44c70fe1fee81cecd0b8d7034410aef488198 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Henning?= <post@soeren-henning.de>
Date: Wed, 22 Jul 2020 12:03:03 +0200
Subject: [PATCH] Add hashCode and equals method

---
 .../uc4/streamprocessing/HourOfDayKey.java    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/uc4-application/src/main/java/theodolite/uc4/streamprocessing/HourOfDayKey.java b/uc4-application/src/main/java/theodolite/uc4/streamprocessing/HourOfDayKey.java
index 214be2dd0..97807e3bd 100644
--- a/uc4-application/src/main/java/theodolite/uc4/streamprocessing/HourOfDayKey.java
+++ b/uc4-application/src/main/java/theodolite/uc4/streamprocessing/HourOfDayKey.java
@@ -1,5 +1,7 @@
 package theodolite.uc4.streamprocessing;
 
+import java.util.Objects;
+
 /**
  * Composed key of an hour of the day and a sensor id.
  */
@@ -26,4 +28,22 @@ public class HourOfDayKey {
     return this.sensorId + ";" + this.hourOfDay;
   }
 
+  @Override
+  public int hashCode() {
+    return Objects.hash(this.hourOfDay, this.sensorId);
+  }
+
+  @Override
+  public boolean equals(final Object obj) {
+    if (obj == this) {
+      return true;
+    }
+    if (obj instanceof HourOfDayKey) {
+      final HourOfDayKey other = (HourOfDayKey) obj;
+      return Objects.equals(this.hourOfDay, other.hourOfDay)
+          && Objects.equals(this.sensorId, other.sensorId);
+    }
+    return false;
+  }
+
 }
-- 
GitLab