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

Add equals/hachCode functions

parent 15c44c70
No related branches found
No related tags found
1 merge request!29Resolve "Add equals/hash methods for serializable classes"
Pipeline #728 passed with warnings
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;
}
}
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;
}
}
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