Skip to content
Snippets Groups Projects
Commit a89aeb1e authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'issue54-add-equals-hash-methods-for-serializable-classes' into 'master'

Resolve "Add equals/hash methods for serializable classes"

See merge request !29
parents 6a3ecbe5 27f4c591
No related branches found
No related tags found
1 merge request!29Resolve "Add equals/hash methods for serializable classes"
Pipeline #756 passed with warnings
package theodolite.uc2.streamprocessing; package theodolite.uc2.streamprocessing;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import titan.ccp.models.records.ActivePowerRecord; import titan.ccp.models.records.ActivePowerRecord;
...@@ -26,6 +27,27 @@ public class JointRecordParents { ...@@ -26,6 +27,27 @@ public class JointRecordParents {
return this.record; 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;
}
} }
package theodolite.uc2.streamprocessing; package theodolite.uc2.streamprocessing;
import java.util.Objects;
/** /**
* A key consisting of the identifier of a sensor and an identifier of parent sensor. * A key consisting of the identifier of a sensor and an identifier of parent sensor.
*/ */
...@@ -27,4 +29,22 @@ public class SensorParentKey { ...@@ -27,4 +29,22 @@ public class SensorParentKey {
return "{" + this.sensorIdentifier + ", " + this.parentIdentifier + "}"; 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;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment