mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 16:59:51 +00:00
Hafas: More improvements to splitting place and name, mostly for POIs.
This commit is contained in:
parent
589cf69063
commit
7ff06cc2d4
20 changed files with 213 additions and 81 deletions
|
@ -91,17 +91,37 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
@Override
|
||||
protected String[] splitStationName(final String name)
|
||||
{
|
||||
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(name);
|
||||
if (m.matches())
|
||||
return new String[] { m.group(1), m.group(2) };
|
||||
|
||||
for (final String place : PLACES)
|
||||
{
|
||||
if (name.startsWith(place + " ") || name.startsWith(place + "-"))
|
||||
return new String[] { place, name.substring(place.length() + 1) };
|
||||
else if (name.startsWith(place + ", "))
|
||||
return new String[] { place, name.substring(place.length() + 2) };
|
||||
}
|
||||
|
||||
return super.splitStationName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] splitPOI(final String poi)
|
||||
{
|
||||
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(poi);
|
||||
if (m.matches())
|
||||
return new String[] { m.group(1), m.group(2) };
|
||||
|
||||
return super.splitStationName(poi);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String[] splitAddress(final String address)
|
||||
{
|
||||
final Matcher m = P_SPLIT_NAME_FIRST_COMMA.matcher(address);
|
||||
if (m.matches())
|
||||
return new String[] { m.group(1), m.group(2) };
|
||||
|
||||
return super.splitStationName(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NearbyStationsResult queryNearbyStations(final Location location, final int maxDistance, final int maxStations) throws IOException
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue