diff --git a/uc2-application/src/main/java/theodolite/uc2/streamprocessing/JointRecordParents.java b/uc2-application/src/main/java/theodolite/uc2/streamprocessing/JointRecordParents.java index 02b7318587a77228e7fb2f7dc1b3350bac532c89..71505ad30b49eaa975ad461412b438ed7ccfc8d0 100644 --- a/uc2-application/src/main/java/theodolite/uc2/streamprocessing/JointRecordParents.java +++ b/uc2-application/src/main/java/theodolite/uc2/streamprocessing/JointRecordParents.java @@ -1,5 +1,6 @@ package theodolite.uc2.streamprocessing; +import java.util.Objects; import java.util.Set; import titan.ccp.models.records.ActivePowerRecord; @@ -26,6 +27,27 @@ public class JointRecordParents { return this.record; } + @Override + public String toString() { + return "{" + this.parents + ", " + this.record + "}"; + } + + @Override + public int hashCode() { + return Objects.hash(this.parents, this.record); + } + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof JointRecordParents) { + final JointRecordParents other = (JointRecordParents) obj; + return Objects.equals(this.parents, other.parents) + && Objects.equals(this.record, other.record); + } + return false; + } } diff --git a/uc2-application/src/main/java/theodolite/uc2/streamprocessing/SensorParentKey.java b/uc2-application/src/main/java/theodolite/uc2/streamprocessing/SensorParentKey.java index d65c93034a0fc9a801cf5be0c2f7f50e38d9178e..a4fb5b33966882b94d46c96282bdaaed92d67ebd 100644 --- a/uc2-application/src/main/java/theodolite/uc2/streamprocessing/SensorParentKey.java +++ b/uc2-application/src/main/java/theodolite/uc2/streamprocessing/SensorParentKey.java @@ -1,5 +1,7 @@ package theodolite.uc2.streamprocessing; +import java.util.Objects; + /** * A key consisting of the identifier of a sensor and an identifier of parent sensor. */ @@ -27,4 +29,22 @@ public class SensorParentKey { return "{" + this.sensorIdentifier + ", " + this.parentIdentifier + "}"; } + @Override + public int hashCode() { + return Objects.hash(this.sensorIdentifier, this.parentIdentifier); + } + + @Override + public boolean equals(final Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof SensorParentKey) { + final SensorParentKey other = (SensorParentKey) obj; + return Objects.equals(this.sensorIdentifier, other.sensorIdentifier) + && Objects.equals(this.parentIdentifier, other.parentIdentifier); + } + return false; + } + }