mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-07 23:28:48 +00:00
fixed special case of position
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@121 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
9458f487bf
commit
4f174fe3f9
2 changed files with 24 additions and 3 deletions
|
@ -442,12 +442,12 @@ public final class BahnProvider implements NetworkProvider
|
|||
+ "Abfahrt (\\d+:\\d+)\\n?Uhr, (\\d+\\.\\d+\\.\\d+).*?" // currentTime
|
||||
, Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_COARSE = Pattern.compile("<div class=\"sqdetailsDep trow\">\n(.+?)</div>", Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_FINE = Pattern.compile(".*?" //
|
||||
static final Pattern P_DEPARTURES_FINE = Pattern.compile(".*?" //
|
||||
+ "<span class=\"bold\">(.*?)</span>.*?" // line
|
||||
+ ">>\n\\s*(.+?)\\s*\n<br />\n" // destination
|
||||
+ "<span class=\"bold\">(\\d{1,2}:\\d{2})</span>" // time
|
||||
+ "(?: <span class=\"red\">ca. ([+-]?\\d+)</span>)?" // delay
|
||||
+ "(?:, (Gl\\. " + ParserUtils.P_PLATFORM + "))?" // position
|
||||
+ "(?:(?:, )?(Gl\\. " + ParserUtils.P_PLATFORM + "))?" // position
|
||||
, Pattern.DOTALL);
|
||||
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)");
|
||||
|
||||
|
@ -770,6 +770,8 @@ public final class BahnProvider implements NetworkProvider
|
|||
return "RZr" + number;
|
||||
if (type.equals("N")) // Frankreich, Tours, Orléans
|
||||
return "RN" + number;
|
||||
if (type.equals("VE")) // Lutherstadt Wittenberg
|
||||
return "RVE" + number;
|
||||
|
||||
if (type.equals("S"))
|
||||
return "SS" + number;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.junit.Test;
|
|||
public class BahnProviderTest
|
||||
{
|
||||
@Test
|
||||
public void uebergang()
|
||||
public void connectionUebergang()
|
||||
{
|
||||
assertFineConnectionDetails("<span class=\"bold\">Berlin Hbf</span><br />\n" //
|
||||
+ "Übergang\n" //
|
||||
|
@ -37,10 +37,29 @@ public class BahnProviderTest
|
|||
+ "<span class=\"bold\">Berlin-Lichtenberg</span><br />");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void departureWithPlatform()
|
||||
{
|
||||
assertFineDepartures("<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/731061/244203/590672/51649/80/si=8100352&bt=dep&ti=10:42&pt=10:42&p=1111111111&date=01.09.10&max=10&rt=1&&\">\n" //
|
||||
+ "<span class=\"bold\">S 1</span>\n" //
|
||||
+ "</a>\n" //
|
||||
+ ">>\n" //
|
||||
+ "Gänserndorf\n" //
|
||||
+ "<br />\n" //
|
||||
+ "<span class=\"bold\">10:42</span>Gl. 1");
|
||||
}
|
||||
|
||||
private void assertFineConnectionDetails(String s)
|
||||
{
|
||||
Matcher m = BahnProvider.P_CONNECTION_DETAILS_FINE.matcher(s);
|
||||
assertTrue(m.matches());
|
||||
// ParserUtils.printGroups(m);
|
||||
}
|
||||
|
||||
private void assertFineDepartures(String s)
|
||||
{
|
||||
Matcher m = BahnProvider.P_DEPARTURES_FINE.matcher(s);
|
||||
assertTrue(m.matches());
|
||||
// ParserUtils.printGroups(m);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue