diff --git a/src/de/schildbach/pte/BahnProvider.java b/src/de/schildbach/pte/BahnProvider.java index 2a30a09c..992a3bd9 100644 --- a/src/de/schildbach/pte/BahnProvider.java +++ b/src/de/schildbach/pte/BahnProvider.java @@ -38,7 +38,6 @@ import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.Station; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.util.Color; import de.schildbach.pte.util.ParserUtils; @@ -122,11 +121,6 @@ public final class BahnProvider implements NetworkProvider return new NearbyStationsResult(uri, stations.subList(0, maxStations)); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via, final LocationType toType, final String to, final Date date, final boolean dep) { diff --git a/src/de/schildbach/pte/GvhProvider.java b/src/de/schildbach/pte/GvhProvider.java index b060606c..f9e717e6 100644 --- a/src/de/schildbach/pte/GvhProvider.java +++ b/src/de/schildbach/pte/GvhProvider.java @@ -22,7 +22,6 @@ import java.util.Date; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.util.ParserUtils; /** @@ -67,11 +66,6 @@ public class GvhProvider extends AbstractEfaProvider return null; } - public StationLocationResult stationLocation(String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public String departuresQueryUri(String stationId, int maxDepartures) { final StringBuilder uri = new StringBuilder(); diff --git a/src/de/schildbach/pte/LinzProvider.java b/src/de/schildbach/pte/LinzProvider.java index 2ff6165d..5311260b 100644 --- a/src/de/schildbach/pte/LinzProvider.java +++ b/src/de/schildbach/pte/LinzProvider.java @@ -22,7 +22,6 @@ import java.util.Date; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.util.ParserUtils; /** @@ -73,11 +72,6 @@ public class LinzProvider extends AbstractEfaProvider return String.format(NEARBY_STATION_URI, stationId); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via, final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed) throws IOException diff --git a/src/de/schildbach/pte/MvvProvider.java b/src/de/schildbach/pte/MvvProvider.java index 37635951..b00a7923 100644 --- a/src/de/schildbach/pte/MvvProvider.java +++ b/src/de/schildbach/pte/MvvProvider.java @@ -36,7 +36,6 @@ import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.Station; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.exception.SessionExpiredException; import de.schildbach.pte.util.Color; import de.schildbach.pte.util.ParserUtils; @@ -175,11 +174,6 @@ public class MvvProvider extends AbstractEfaProvider return new NearbyStationsResult(uri, stations.subList(0, maxStations)); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - private static final Map WALKSPEED_MAP = new HashMap(); static { @@ -662,6 +656,8 @@ public class MvvProvider extends AbstractEfaProvider return "B" + line; if (line.equals("Schienenersatzverkehr")) return "BSEV"; + if (line.startsWith("MVV-Ruftaxi ")) + return "B" + line; if (P_NORMALIZE_LINE_TRAM.matcher(line).matches()) return "T" + line; if (P_NORMALIZE_LINE_NACHTTRAM.matcher(line).matches()) diff --git a/src/de/schildbach/pte/NasaProvider.java b/src/de/schildbach/pte/NasaProvider.java index 6b224d39..aa19c4d6 100644 --- a/src/de/schildbach/pte/NasaProvider.java +++ b/src/de/schildbach/pte/NasaProvider.java @@ -33,7 +33,6 @@ import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.ParserUtils; @@ -70,11 +69,6 @@ public class NasaProvider extends AbstractHafasProvider return String.format(NEARBY_URI, stationId); } - public StationLocationResult stationLocation(String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public String departuresQueryUri(final String stationId, final int maxDepartures) { final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yy"); diff --git a/src/de/schildbach/pte/NetworkProvider.java b/src/de/schildbach/pte/NetworkProvider.java index b869e98b..1aaf4ca1 100644 --- a/src/de/schildbach/pte/NetworkProvider.java +++ b/src/de/schildbach/pte/NetworkProvider.java @@ -26,7 +26,6 @@ import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; /** * Interface to be implemented by providers of transportation networks @@ -80,16 +79,6 @@ public interface NetworkProvider */ NearbyStationsResult nearbyStations(String stationId, int lat, int lon, int maxDistance, int maxStations) throws IOException; - /** - * Look up location of station. - * - * @param stationId - * id of station to look up - * @return location - * @throws IOException - */ - StationLocationResult stationLocation(String stationId) throws IOException; - /** * Query connections, asking for any ambiguousnesses * @@ -109,7 +98,8 @@ public interface NetworkProvider * desired date for departing, mandatory * @param dep * date is departure date? {@code true} for departure, {@code false} for arrival - * @param products TODO + * @param products + * TODO * @param walkSpeed * how fast can you walk? * @param products diff --git a/src/de/schildbach/pte/OebbProvider.java b/src/de/schildbach/pte/OebbProvider.java index 159ec7ed..d2cc6dbe 100644 --- a/src/de/schildbach/pte/OebbProvider.java +++ b/src/de/schildbach/pte/OebbProvider.java @@ -38,7 +38,6 @@ import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.exception.SessionExpiredException; import de.schildbach.pte.util.ParserUtils; @@ -138,11 +137,6 @@ public class OebbProvider extends AbstractHafasProvider return String.format(NEARBY_URI, stationId); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - private static final Map WALKSPEED_MAP = new HashMap(); static { diff --git a/src/de/schildbach/pte/RmvProvider.java b/src/de/schildbach/pte/RmvProvider.java index 28fb8d8a..f574c01c 100644 --- a/src/de/schildbach/pte/RmvProvider.java +++ b/src/de/schildbach/pte/RmvProvider.java @@ -38,7 +38,6 @@ import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; import de.schildbach.pte.dto.Station; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.ParserUtils; @@ -137,31 +136,6 @@ public class RmvProvider extends AbstractHafasProvider } } - private static Pattern P_STATION_LOCATION = Pattern - .compile("REQMapRoute0\\.Location0\\.X=(\\d+)&REQMapRoute0\\.Location0\\.Y=(\\d+)&REQMapRoute0\\.Location0\\.Name=(.+?)\""); - - public StationLocationResult stationLocation(final String stationId) throws IOException - { - final String uri = API_BASE + "stboard.exe/dn?L=vs_rmv&selectDate=today&time=now&showStBoard=yes&boardType=dep&maxJourneys=10&start&input=" - + stationId; - - final CharSequence page = ParserUtils.scrape(uri); - - final Matcher m = P_STATION_LOCATION.matcher(page); - if (m.find()) - { - final int lon = Integer.parseInt(m.group(1)); - final int lat = Integer.parseInt(m.group(2)); - final String name = ParserUtils.resolveEntities(m.group(3)); - - return new StationLocationResult(lat, lon, name); - } - else - { - throw new IllegalArgumentException("cannot parse '" + page + "' on " + uri); - } - } - private static double latLonToDouble(int value) { return (double) value / 1000000; diff --git a/src/de/schildbach/pte/SbbProvider.java b/src/de/schildbach/pte/SbbProvider.java index 8e73d774..0bb5425b 100644 --- a/src/de/schildbach/pte/SbbProvider.java +++ b/src/de/schildbach/pte/SbbProvider.java @@ -34,7 +34,6 @@ import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.ParserUtils; @@ -92,12 +91,6 @@ public class SbbProvider extends AbstractHafasProvider return String.format(NEARBY_URI, stationId); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - // final String uri = "http://fahrplan.sbb.ch/bin/extxml.exe/dn"; - } - private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via, final LocationType toType, final String to, final Date date, final boolean dep) { diff --git a/src/de/schildbach/pte/SncbProvider.java b/src/de/schildbach/pte/SncbProvider.java index 01beb8fd..9d0b9b44 100644 --- a/src/de/schildbach/pte/SncbProvider.java +++ b/src/de/schildbach/pte/SncbProvider.java @@ -31,7 +31,6 @@ import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.ParserUtils; @@ -66,11 +65,6 @@ public class SncbProvider extends AbstractHafasProvider return String.format(NEARBY_URI, stationId); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via, final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed) throws IOException diff --git a/src/de/schildbach/pte/TflProvider.java b/src/de/schildbach/pte/TflProvider.java index b69eac16..cdf6c272 100644 --- a/src/de/schildbach/pte/TflProvider.java +++ b/src/de/schildbach/pte/TflProvider.java @@ -32,7 +32,6 @@ import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.Color; import de.schildbach.pte.util.ParserUtils; @@ -60,11 +59,6 @@ public class TflProvider implements NetworkProvider throw new UnsupportedOperationException(); } - public StationLocationResult stationLocation(final String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public QueryConnectionsResult queryConnections(final LocationType fromType, final String from, final LocationType viaType, final String via, final LocationType toType, final String to, final Date date, final boolean dep, final String products, final WalkSpeed walkSpeed) throws IOException diff --git a/src/de/schildbach/pte/VbbProvider.java b/src/de/schildbach/pte/VbbProvider.java index 9422f41a..d605c586 100644 --- a/src/de/schildbach/pte/VbbProvider.java +++ b/src/de/schildbach/pte/VbbProvider.java @@ -38,7 +38,6 @@ import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.NearbyStationsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.Color; import de.schildbach.pte.util.ParserUtils; @@ -113,52 +112,6 @@ public final class VbbProvider implements NetworkProvider throw new UnsupportedOperationException(); } - private static Pattern P_STATION_LOCATION = Pattern.compile("" - + DATE_FORMAT.format(now) - + "" - + DATE_FORMAT.format(now) + ""; - final String uri = "http://www.vbb-fahrinfo.de/hafas/extxml/extxml.exe/dn"; - - final CharSequence page = ParserUtils.scrape(uri, false, request, null, false); - - final Matcher mError = P_STATION_LOCATION_ERROR.matcher(page); - if (mError.find()) - { - if (mError.group(1) != null) - return null; - if (mError.group(2) != null) - throw new RuntimeException("timeout error"); - } - - final Matcher m = P_STATION_LOCATION.matcher(page); - if (m.find()) - { - final String name = ParserUtils.resolveEntities(m.group(1)); - final int lon = Integer.parseInt(m.group(2)); - final int lat = Integer.parseInt(m.group(3)); - - return new StationLocationResult(lat, lon, name); - } - else - { - throw new IllegalArgumentException("cannot parse '" + page + "' on " + uri); - } - } - public static final String STATION_URL_CONNECTION = "http://mobil.bvg.de/Fahrinfo/bin/query.bin/dox"; private String connectionsQueryUri(final LocationType fromType, final String from, final LocationType viaType, final String via, diff --git a/src/de/schildbach/pte/VgsProvider.java b/src/de/schildbach/pte/VgsProvider.java index 290f8119..4705a614 100644 --- a/src/de/schildbach/pte/VgsProvider.java +++ b/src/de/schildbach/pte/VgsProvider.java @@ -33,7 +33,6 @@ import de.schildbach.pte.dto.Departure; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; import de.schildbach.pte.dto.QueryDeparturesResult; -import de.schildbach.pte.dto.StationLocationResult; import de.schildbach.pte.dto.QueryDeparturesResult.Status; import de.schildbach.pte.util.ParserUtils; @@ -70,11 +69,6 @@ public class VgsProvider extends AbstractHafasProvider return String.format(NEARBY_URI, stationId); } - public StationLocationResult stationLocation(String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public String departuresQueryUri(final String stationId, final int maxDepartures) { final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yy"); diff --git a/src/de/schildbach/pte/VrnProvider.java b/src/de/schildbach/pte/VrnProvider.java index a20264d2..eb1fcee3 100644 --- a/src/de/schildbach/pte/VrnProvider.java +++ b/src/de/schildbach/pte/VrnProvider.java @@ -21,7 +21,6 @@ import java.util.Date; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; -import de.schildbach.pte.dto.StationLocationResult; /** * @author Andreas Schildbach @@ -62,11 +61,6 @@ public class VrnProvider extends AbstractEfaProvider return String.format(NEARBY_STATION_URI, stationId); } - public StationLocationResult stationLocation(String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public String departuresQueryUri(final String stationId, final int maxDepartures) { final StringBuilder uri = new StringBuilder(); diff --git a/src/de/schildbach/pte/VrrProvider.java b/src/de/schildbach/pte/VrrProvider.java index d340c359..36d282e8 100644 --- a/src/de/schildbach/pte/VrrProvider.java +++ b/src/de/schildbach/pte/VrrProvider.java @@ -21,7 +21,6 @@ import java.util.Date; import de.schildbach.pte.dto.GetConnectionDetailsResult; import de.schildbach.pte.dto.QueryConnectionsResult; -import de.schildbach.pte.dto.StationLocationResult; /** * @author Andreas Schildbach @@ -62,11 +61,6 @@ public class VrrProvider extends AbstractEfaProvider return String.format(NEARBY_STATION_URI, stationId); } - public StationLocationResult stationLocation(String stationId) throws IOException - { - throw new UnsupportedOperationException(); - } - public String departuresQueryUri(final String stationId, final int maxDepartures) { final StringBuilder uri = new StringBuilder(); diff --git a/src/de/schildbach/pte/dto/StationLocationResult.java b/src/de/schildbach/pte/dto/StationLocationResult.java deleted file mode 100644 index 69fd94e0..00000000 --- a/src/de/schildbach/pte/dto/StationLocationResult.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010 the original author or authors. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package de.schildbach.pte.dto; - -/** - * @author Andreas Schildbach - */ -public final class StationLocationResult -{ - public final double lat, lon; - public final String name; - - public StationLocationResult(final int lat, final int lon, final String name) - { - this.lat = lat; - this.lon = lon; - this.name = name; - } -}