mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 06:08:52 +00:00
fixed equals/hashCode
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@950 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
1f08364904
commit
ed3ce3ccc5
1 changed files with 8 additions and 4 deletions
|
@ -123,9 +123,11 @@ public final class Location implements Serializable
|
||||||
return false;
|
return false;
|
||||||
if (this.id != other.id)
|
if (this.id != other.id)
|
||||||
return false;
|
return false;
|
||||||
if (this.id != 0) // TODO needed?
|
if (this.lat != other.lat || this.lon != other.lon)
|
||||||
|
return false;
|
||||||
|
if (this.id == 0 && !nullSafeEquals(this.name, other.name)) // only discriminate by name if no ids are given
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
return nullSafeEquals(this.name, other.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -136,7 +138,9 @@ public final class Location implements Serializable
|
||||||
hashCode *= 29;
|
hashCode *= 29;
|
||||||
hashCode += id;
|
hashCode += id;
|
||||||
hashCode *= 29;
|
hashCode *= 29;
|
||||||
hashCode += nullSafeHashCode(name);
|
hashCode += lat;
|
||||||
|
hashCode *= 29;
|
||||||
|
hashCode += lon;
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue