mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-16 09:29:49 +00:00
Make sure places without name cannot exist.
This commit is contained in:
parent
9b1ece6cdf
commit
544fa018ca
1 changed files with 11 additions and 0 deletions
|
@ -39,6 +39,9 @@ public final class Location implements Serializable
|
|||
this.lon = lon;
|
||||
this.place = place;
|
||||
this.name = name;
|
||||
|
||||
if (name == null && place != null)
|
||||
throw new IllegalArgumentException("places without name cannot exist");
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final String id, final String place, final String name)
|
||||
|
@ -49,6 +52,9 @@ public final class Location implements Serializable
|
|||
this.lon = 0;
|
||||
this.place = place;
|
||||
this.name = name;
|
||||
|
||||
if (name == null && place != null)
|
||||
throw new IllegalArgumentException("places without name cannot exist");
|
||||
}
|
||||
|
||||
public Location(final LocationType type, final String id, final int lat, final int lon)
|
||||
|
@ -91,6 +97,11 @@ public final class Location implements Serializable
|
|||
return lat != 0 || lon != 0;
|
||||
}
|
||||
|
||||
public final boolean hasName()
|
||||
{
|
||||
return name != null;
|
||||
}
|
||||
|
||||
public final boolean isIdentified()
|
||||
{
|
||||
if (type == LocationType.STATION)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue