mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-20 01:10:02 +00:00
do not pre-populate connections with half-baked parts
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@62 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
9abab75816
commit
ea85db9851
6 changed files with 30 additions and 33 deletions
|
@ -250,8 +250,7 @@ public final class BahnProvider implements NetworkProvider
|
|||
Date departureTime = ParserUtils.joinDateTime(currentDate, ParserUtils.parseTime(mConFine.group(2)));
|
||||
if (!connections.isEmpty())
|
||||
{
|
||||
final long diff = ParserUtils.timeDiff(departureTime,
|
||||
((Connection.Trip) connections.get(connections.size() - 1).parts.get(0)).departureTime);
|
||||
final long diff = ParserUtils.timeDiff(departureTime, connections.get(connections.size() - 1).departureTime);
|
||||
if (diff > PARSER_DAY_ROLLOVER_THRESHOLD_MS)
|
||||
departureTime = ParserUtils.addDays(departureTime, -1);
|
||||
else if (diff < -PARSER_DAY_ROLLOVER_THRESHOLD_MS)
|
||||
|
@ -265,9 +264,8 @@ public final class BahnProvider implements NetworkProvider
|
|||
line = normalizeLine(line);
|
||||
else
|
||||
line = null;
|
||||
final Connection connection = new Connection(ParserUtils.extractId(link), link, departureTime, arrivalTime, 0, from, 0, to,
|
||||
new ArrayList<Connection.Part>(1));
|
||||
connection.parts.add(new Connection.Trip(departureTime, arrivalTime, line, line != null ? LINES.get(line.charAt(0)) : null));
|
||||
final Connection connection = new Connection(ParserUtils.extractId(link), link, departureTime, arrivalTime, line,
|
||||
line != null ? LINES.get(line.charAt(0)) : null, 0, from, 0, to, null);
|
||||
connections.add(connection);
|
||||
}
|
||||
else
|
||||
|
@ -394,8 +392,8 @@ public final class BahnProvider implements NetworkProvider
|
|||
if (firstDepartureTime == null || lastArrivalTime == null)
|
||||
throw new IllegalStateException("could not parse all parts of:\n" + page + "\n" + parts);
|
||||
|
||||
return new GetConnectionDetailsResult(new Date(), new Connection(ParserUtils.extractId(uri), uri, firstDepartureTime, lastArrivalTime, 0,
|
||||
firstDeparture, 0, lastArrival, parts));
|
||||
return new GetConnectionDetailsResult(new Date(), new Connection(ParserUtils.extractId(uri), uri, firstDepartureTime, lastArrivalTime,
|
||||
null, null, 0, firstDeparture, 0, lastArrival, parts));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue