Commit 5f93c5bc authored by Jakob Schöttl's avatar Jakob Schöttl

Bugfix: Implement hash and equals for keys

parent 7c6b5864
......@@ -14,4 +14,26 @@ public class TimestepDataKey implements Comparable<TimestepDataKey> {
public static String getHeader() {
return "ts";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + timestep;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TimestepDataKey other = (TimestepDataKey) obj;
if (timestep != other.timestep)
return false;
return true;
}
}
......@@ -29,4 +29,29 @@ public class TimestepPedestrianIdDataKey implements Comparable<TimestepPedestria
public static String[] getHeaders() {
return new String[] { TimestepDataKey.getHeader(), PedestrianIdDataKey.getHeader() };
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + pedestrianId;
result = prime * result + timestep;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TimestepPedestrianIdDataKey other = (TimestepPedestrianIdDataKey) obj;
if (pedestrianId != other.pedestrianId)
return false;
if (timestep != other.timestep)
return false;
return true;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment