fixed ordering of messages

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@155 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-09-09 13:22:22 +00:00
parent 7dfc244ce7
commit 45724ce974
2 changed files with 17 additions and 1 deletions

View file

@ -456,8 +456,8 @@ public final class BahnProvider implements NetworkProvider
+ "(?:&nbsp;<span class=\"[\\w ]*\">(?:(p&#252;nktl\\.)|ca. \\+(\\d+))</span>)?" // ontime, delay + "(?:&nbsp;<span class=\"[\\w ]*\">(?:(p&#252;nktl\\.)|ca. \\+(\\d+))</span>)?" // ontime, delay
+ "(?:&nbsp;k\\.A\\.)?" // + "(?:&nbsp;k\\.A\\.)?" //
+ "(?:, <span class=\"red\">([^<]*)</span>)?" // message + "(?:, <span class=\"red\">([^<]*)</span>)?" // message
+ "(?:,<br/><a[^>]*><span class=\"red\">[^<]*</a></span>)?" // (ersatzzug message)
+ "(?:(?:,&nbsp;)?(?:<span class=\"red\">heute )?(Gl\\. " + ParserUtils.P_PLATFORM + ")(?:\\s*</span>)?)?" // position + "(?:(?:,&nbsp;)?(?:<span class=\"red\">heute )?(Gl\\. " + ParserUtils.P_PLATFORM + ")(?:\\s*</span>)?)?" // position
+ "(?:,<br/><a[^>]*><span class=\"red\">[^<]*</a></span>)?" // (ersatzzug message)
, Pattern.DOTALL); , Pattern.DOTALL);
private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)"); private static final Pattern P_DEPARTURES_URI_STATION_ID = Pattern.compile("input=(\\d+)");

View file

@ -146,6 +146,22 @@ public class BahnProviderTest
assertNotNull(m.group(6)); // message assertNotNull(m.group(6)); // message
} }
@Test
public void departureWithPositionAndMessages()
{
final Matcher m = assertFineDepartures("" //
+ "<a href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/32967/150423/39690/8856/80/si=676819&amp;bt=dep&amp;ti=00:57&amp;pt=00:57&amp;p=1111111111&amp;date=09.09.10&amp;max=10&amp;rt=1&amp;&amp;\">\n" //
+ "<span class=\"bold\">RB 34075</span>\n" //
+ "</a>\n" //
+ "&gt;&gt;\n" //
+ "N&#252;rnberg Hbf\n" //
+ "<br />\n" //
+ "<span class=\"bold\">00:18</span>, <span class=\"red\">Zug f&#228;llt aus</span>,&nbsp;Gl. 4,<br/><a class=\"red underline\" href=\"http://mobile.bahn.de/bin/mobil/traininfo.exe/dox/843399/1026627/462944/49661/80?ld=96159&amp;rt=1&amp;use_realtime_filter=1&amp;date=09.09.10&amp;time=00:18&amp;station_evaId=8001844&amp;station_type=dep&amp;\"><span class=\"red\">Ersatzzug&nbsp;RB 30535</a></span>");
assertNotNull(m.group(6)); // message
assertNotNull(m.group(7)); // position
}
private void assertFineConnectionDetails(String s) private void assertFineConnectionDetails(String s)
{ {
Matcher m = BahnProvider.P_CONNECTION_DETAILS_FINE.matcher(s); Matcher m = BahnProvider.P_CONNECTION_DETAILS_FINE.matcher(s);