locationId in QueryDeparturesResult

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@17 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-07-20 14:47:13 +00:00
parent 1315484d07
commit f505d2eda8
5 changed files with 34 additions and 7 deletions

View file

@ -387,11 +387,17 @@ public class RmvProvider implements NetworkProvider
+ "<br />.*?" //
+ "<b>(\\d+:\\d+)</b>.*?" // time
+ "(?:Gl\\. (\\d+)<br />.*?)?", Pattern.DOTALL);
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)");
public QueryDeparturesResult queryDepartures(final String uri) throws IOException
{
final CharSequence page = ParserUtils.scrape(uri);
final Matcher mStationId = P_DEPARTURES_URI_STATION_ID.matcher(uri);
if (!mStationId.find())
throw new IllegalStateException(uri);
final int stationId = Integer.parseInt(mStationId.group(1));
// parse page
final Matcher mHead = P_DEPARTURES_HEAD.matcher(page);
if (mHead.matches())
@ -417,7 +423,7 @@ public class RmvProvider implements NetworkProvider
}
}
return new QueryDeparturesResult(uri, location, currentTime, departures);
return new QueryDeparturesResult(uri, stationId, location, currentTime, departures);
}
else
{