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

Add equals/hachCode functions

parent 9e7a745e
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !11. Comments created here will be created in the context of that merge request.
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