mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 00:09:55 +00:00
try to split place from addresses as well
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@683 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
caaf389634
commit
b8592a1740
1 changed files with 9 additions and 2 deletions
|
@ -112,9 +112,15 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
return 0;
|
||||
}
|
||||
|
||||
private static final Pattern P_SPLIT_ADDRESS = Pattern.compile("(\\d{5}\\s+[^,]+),\\s+(.*)");
|
||||
|
||||
protected String[] splitPlaceAndName(final String name)
|
||||
{
|
||||
return new String[] { null, name };
|
||||
final Matcher matcher = P_SPLIT_ADDRESS.matcher(name);
|
||||
if (matcher.matches())
|
||||
return new String[] { matcher.group(1), matcher.group(2) };
|
||||
else
|
||||
return new String[] { null, name };
|
||||
}
|
||||
|
||||
private final String wrap(final String request)
|
||||
|
@ -291,7 +297,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
}
|
||||
else if (type == 2) // address
|
||||
{
|
||||
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, null, value));
|
||||
final String[] placeAndName = splitPlaceAndName(value);
|
||||
results.add(new Location(LocationType.ADDRESS, 0, lat, lon, placeAndName[0], placeAndName[1]));
|
||||
}
|
||||
else if (type == 4) // poi
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue