mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
Fix false positives in Location.equals().
This commit is contained in:
parent
b4ac8f72cb
commit
ae00988db7
2 changed files with 10 additions and 5 deletions
|
@ -145,7 +145,7 @@ public final class Location implements Serializable
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
public boolean equals(final Object o)
|
||||
{
|
||||
if (o == this)
|
||||
return true;
|
||||
|
@ -154,10 +154,10 @@ public final class Location implements Serializable
|
|||
final Location other = (Location) o;
|
||||
if (this.type != other.type)
|
||||
return false;
|
||||
if (this.id != 0 && this.id == other.id)
|
||||
return true;
|
||||
if (this.lat != 0 && this.lon != 0 && this.lat == other.lat && this.lon == other.lon)
|
||||
return true;
|
||||
if (this.id != 0)
|
||||
return this.id == other.id;
|
||||
if (this.lat != 0 && this.lon != 0)
|
||||
return this.lat == other.lat && this.lon == other.lon;
|
||||
if (!nullSafeEquals(this.name, other.name)) // only discriminate by name if no ids are given
|
||||
return false;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue