mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-19 08:49:58 +00:00
nearbyStations() gets its own result object
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@237 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
ae3cc77277
commit
94d99f7e53
18 changed files with 115 additions and 70 deletions
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
import de.schildbach.pte.dto.Station;
|
||||
import de.schildbach.pte.util.Color;
|
||||
import de.schildbach.pte.util.ParserUtils;
|
||||
|
@ -41,7 +42,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
|
||||
protected abstract String nearbyStationUri(String stationId);
|
||||
|
||||
public List<Station> nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
|
||||
public NearbyStationsResult nearbyStations(final String stationId, final int lat, final int lon, final int maxDistance, final int maxStations)
|
||||
throws IOException
|
||||
{
|
||||
if (stationId == null)
|
||||
|
@ -89,9 +90,9 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
}
|
||||
|
||||
if (maxStations == 0 || maxStations >= stations.size())
|
||||
return stations;
|
||||
return new NearbyStationsResult(uri, stations);
|
||||
else
|
||||
return stations.subList(0, maxStations);
|
||||
return new NearbyStationsResult(uri, stations.subList(0, maxStations));
|
||||
}
|
||||
|
||||
protected static final Pattern P_NORMALIZE_LINE = Pattern.compile("([A-Za-zÄÖÜäöüßáàâéèêíìîóòôúùû/-]+)[\\s-]*(.*)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue