mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-17 05:59:51 +00:00
removed obsolete method
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@242 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
dcd673d6f7
commit
1a269d808a
16 changed files with 4 additions and 192 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, String> WALKSPEED_MAP = new HashMap<WalkSpeed, String>();
|
||||
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())
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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, String> WALKSPEED_MAP = new HashMap<WalkSpeed, String>();
|
||||
static
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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("<Station name=\"(.*?)\" x=\"(\\d+)\" y=\"(\\d+)\" type=\"WGS84\"");
|
||||
private static Pattern P_STATION_LOCATION_ERROR = Pattern.compile("(No trains in result)|(No Response from Server)");
|
||||
|
||||
public StationLocationResult stationLocation(final String stationId) throws IOException
|
||||
{
|
||||
final boolean live = stationId.length() == 6;
|
||||
if (live)
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd");
|
||||
final DateFormat TIME_FORMAT = new SimpleDateFormat("HH:mm");
|
||||
final Date now = new Date();
|
||||
final String request = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><ReqC lang=\"DE\" prod=\"testsystem\" ver=\"1.1\" accessId=\"VBB-STD\"><STBReq boardType='DEP'><Time>"
|
||||
+ TIME_FORMAT.format(now)
|
||||
+ "</Time><Period><DateBegin>"
|
||||
+ DATE_FORMAT.format(now)
|
||||
+ "</DateBegin><DateEnd>"
|
||||
+ DATE_FORMAT.format(now) + "</DateEnd></Period><TableStation externalId='" + stationId + "'/></STBReq></ReqC>";
|
||||
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,
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue