I've added an equals method that takes into consideration only the object's position and timepoint.

This commit is contained in:
I077899 committed 2012-12-04 10:43:12 +02:00
1 parent aa2cee3dbd
commit 421f62928f
1 file changed
+38 -8
@@ -4,19 +4,49 @@ import com.google.gwt.user.client.rpc.IsSerializable;
public class SimulatorWindDTO implements IsSerializable {
public boolean isTurn;
//public Double trueWindSpeedInMetersPerSecond;
public Double trueWindSpeedInKnots;
public Double trueWindBearingDeg;
//public Double trueWindFromDeg;
//public Double dampenedTrueWindSpeedInMetersPerSecond;
//public Double dampenedTrueWindSpeedInKnots;
//public Double dampenedTrueWindBearingDeg;
//public Double dampenedTrueWindFromDeg;
public PositionDTO position;
public Long timepoint;
//public Long originTimepoint;
//public Double confidence;
public SimulatorWindDTO() {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp = 0;
temp = this.trueWindSpeedInKnots.intValue();
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = this.trueWindBearingDeg.intValue();
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = this.timepoint.intValue();
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = this.position.hashCode();
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
@Override
public boolean equals(final Object o) {
if (o == null) {
return false;
} else {
if (o instanceof SimulatorWindDTO) {
final SimulatorWindDTO other = (SimulatorWindDTO) o;
return this.position.equals(other.position) && (Math.abs(this.timepoint - other.timepoint) < 9999);
}
return false;
}
}
}