make footway arrival clickable

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@131 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-09-05 12:51:17 +00:00
parent 1ab51c23f5
commit d9499a3329
7 changed files with 35 additions and 23 deletions

View file

@ -388,11 +388,11 @@ public final class BahnProvider implements NetworkProvider
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{ {
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), lastFootway.departure, arrival)); parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), 0, lastFootway.departure, 0, arrival));
} }
else else
{ {
parts.add(new Connection.Footway(Integer.parseInt(min), departure, arrival)); parts.add(new Connection.Footway(Integer.parseInt(min), 0, departure, 0, arrival));
} }
lastArrival = arrival; lastArrival = arrival;
@ -401,7 +401,7 @@ public final class BahnProvider implements NetworkProvider
{ {
final String arrival = ParserUtils.resolveEntities(mDetFine.group(12)); final String arrival = ParserUtils.resolveEntities(mDetFine.group(12));
parts.add(new Connection.Footway(0, departure, arrival)); parts.add(new Connection.Footway(0, 0, departure, 0, arrival));
} }
} }
else else

View file

@ -118,11 +118,6 @@ public final class Connection implements Serializable
this.arrival = arrival; this.arrival = arrival;
} }
public Trip(final Date departureTime, final Date arrivalTime, final String line, final int[] lineColors)
{
this(line, lineColors, null, departureTime, null, 0, null, arrivalTime, null, 0, null);
}
@Override @Override
public String toString() public String toString()
{ {
@ -144,13 +139,17 @@ public final class Connection implements Serializable
public final static class Footway implements Part public final static class Footway implements Part
{ {
final public int min; final public int min;
final public int departureId;
final public String departure; final public String departure;
final public int arrivalId;
final public String arrival; final public String arrival;
public Footway(final int min, final String departure, final String arrival) public Footway(final int min, final int departureId, final String departure, final int arrivalId, final String arrival)
{ {
this.min = min; this.min = min;
this.departureId = departureId;
this.departure = departure; this.departure = departure;
this.arrivalId = arrivalId;
this.arrival = arrival; this.arrival = arrival;
} }
@ -160,9 +159,9 @@ public final class Connection implements Serializable
final StringBuilder builder = new StringBuilder(getClass().getName() + "["); final StringBuilder builder = new StringBuilder(getClass().getName() + "[");
builder.append("min=").append(min); builder.append("min=").append(min);
builder.append(","); builder.append(",");
builder.append("departure=").append(departure); builder.append("departure=").append(departureId).append("/").append(departure);
builder.append(","); builder.append(",");
builder.append("arrival=").append(arrival); builder.append("arrival=").append(arrivalId).append("/").append(arrival);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View file

@ -536,11 +536,11 @@ public class MvvProvider implements NetworkProvider
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{ {
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), lastFootway.departure, arrival)); parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), 0, lastFootway.departure, 0, arrival));
} }
else else
{ {
parts.add(new Connection.Footway(Integer.parseInt(min), departure, arrival)); parts.add(new Connection.Footway(Integer.parseInt(min), 0, departure, 0, arrival));
} }
lastArrival = arrival; lastArrival = arrival;

View file

@ -288,6 +288,8 @@ public class OebbProvider implements NetworkProvider
final Matcher mDetFine = P_CONNECTION_DETAILS_FINE.matcher(set); final Matcher mDetFine = P_CONNECTION_DETAILS_FINE.matcher(set);
if (mDetFine.matches()) if (mDetFine.matches())
{ {
final int departureId = mDetFine.group(1) != null ? Integer.parseInt(mDetFine.group(1)) : 0;
final String departure = ParserUtils.resolveEntities(mDetFine.group(2)); final String departure = ParserUtils.resolveEntities(mDetFine.group(2));
Date departureDate = mDetFine.group(3) != null ? ParserUtils.parseDate(mDetFine.group(3)) : null; Date departureDate = mDetFine.group(3) != null ? ParserUtils.parseDate(mDetFine.group(3)) : null;
@ -298,6 +300,8 @@ public class OebbProvider implements NetworkProvider
final String lineType = mDetFine.group(6); final String lineType = mDetFine.group(6);
final int arrivalId = mDetFine.group(8) != null ? Integer.parseInt(mDetFine.group(8)) : 0;
final String arrival = ParserUtils.resolveEntities(mDetFine.group(9)); final String arrival = ParserUtils.resolveEntities(mDetFine.group(9));
Date arrivalDate = mDetFine.group(10) != null ? ParserUtils.parseDate(mDetFine.group(10)) : null; Date arrivalDate = mDetFine.group(10) != null ? ParserUtils.parseDate(mDetFine.group(10)) : null;
@ -308,7 +312,8 @@ public class OebbProvider implements NetworkProvider
if (!lineType.equals("fuss")) if (!lineType.equals("fuss"))
{ {
final int departureId = Integer.parseInt(mDetFine.group(1)); if (departureId == 0)
throw new IllegalStateException("departureId");
final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mDetFine.group(4))); final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mDetFine.group(4)));
@ -316,7 +321,8 @@ public class OebbProvider implements NetworkProvider
final String line = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7))); final String line = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7)));
final int arrivalId = Integer.parseInt(mDetFine.group(8)); if (arrivalId == 0)
throw new IllegalStateException("arrivalId");
final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate, ParserUtils.parseTime(mDetFine.group(11))); final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate, ParserUtils.parseTime(mDetFine.group(11)));
@ -330,7 +336,7 @@ public class OebbProvider implements NetworkProvider
{ {
final int min = Integer.parseInt(mDetFine.group(13)); final int min = Integer.parseInt(mDetFine.group(13));
final Connection.Footway footway = new Connection.Footway(min, departure, arrival); final Connection.Footway footway = new Connection.Footway(min, departureId, departure, arrivalId, arrival);
connection.parts.add(footway); connection.parts.add(footway);
} }
} }

View file

@ -387,11 +387,11 @@ public class RmvProvider implements NetworkProvider
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{ {
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), lastFootway.departure, arrival)); parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), 0, lastFootway.departure, 0, arrival));
} }
else else
{ {
parts.add(new Connection.Footway(Integer.parseInt(min), departure, arrival)); parts.add(new Connection.Footway(Integer.parseInt(min), 0, departure, 0, arrival));
} }
} }
} }

View file

@ -288,6 +288,8 @@ public class SbbProvider implements NetworkProvider
final Matcher mDetFine = P_CONNECTION_DETAILS_FINE.matcher(set); final Matcher mDetFine = P_CONNECTION_DETAILS_FINE.matcher(set);
if (mDetFine.matches()) if (mDetFine.matches())
{ {
final int departureId = mDetFine.group(1) != null ? Integer.parseInt(mDetFine.group(1)) : 0;
final String departure = ParserUtils.resolveEntities(mDetFine.group(2)); final String departure = ParserUtils.resolveEntities(mDetFine.group(2));
Date departureDate = mDetFine.group(3) != null ? ParserUtils.parseDate(mDetFine.group(3)) : null; Date departureDate = mDetFine.group(3) != null ? ParserUtils.parseDate(mDetFine.group(3)) : null;
@ -298,6 +300,8 @@ public class SbbProvider implements NetworkProvider
final String lineType = mDetFine.group(6); final String lineType = mDetFine.group(6);
final int arrivalId = mDetFine.group(9) != null ? Integer.parseInt(mDetFine.group(9)) : 0;
final String arrival = ParserUtils.resolveEntities(mDetFine.group(10)); final String arrival = ParserUtils.resolveEntities(mDetFine.group(10));
Date arrivalDate = mDetFine.group(11) != null ? ParserUtils.parseDate(mDetFine.group(11)) : null; Date arrivalDate = mDetFine.group(11) != null ? ParserUtils.parseDate(mDetFine.group(11)) : null;
@ -308,7 +312,8 @@ public class SbbProvider implements NetworkProvider
if (!lineType.equals("fuss") && !lineType.equals("transfer")) if (!lineType.equals("fuss") && !lineType.equals("transfer"))
{ {
final int departureId = Integer.parseInt(mDetFine.group(1)); if (departureId == 0)
throw new IllegalStateException("departureId");
final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mDetFine.group(4))); final Date departureTime = ParserUtils.joinDateTime(departureDate, ParserUtils.parseTime(mDetFine.group(4)));
@ -316,7 +321,8 @@ public class SbbProvider implements NetworkProvider
final String line = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7))); final String line = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7)));
final int arrivalId = Integer.parseInt(mDetFine.group(9)); if (arrivalId == 0)
throw new IllegalStateException("arrivalId");
final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate, ParserUtils.parseTime(mDetFine.group(12))); final Date arrivalTime = ParserUtils.joinDateTime(arrivalDate, ParserUtils.parseTime(mDetFine.group(12)));
@ -330,7 +336,7 @@ public class SbbProvider implements NetworkProvider
{ {
final int min = Integer.parseInt(mDetFine.group(8)); final int min = Integer.parseInt(mDetFine.group(8));
final Connection.Footway footway = new Connection.Footway(min, departure, arrival); final Connection.Footway footway = new Connection.Footway(min, departureId, departure, arrivalId, arrival);
connection.parts.add(footway); connection.parts.add(footway);
} }
} }

View file

@ -458,11 +458,12 @@ public final class VbbProvider implements NetworkProvider
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
{ {
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), lastFootway.departure, arrival)); parts.add(new Connection.Footway(lastFootway.min + Integer.parseInt(min), lastFootway.departureId, lastFootway.departure,
arrivalId, arrival));
} }
else else
{ {
parts.add(new Connection.Footway(Integer.parseInt(min), departure, arrival)); parts.add(new Connection.Footway(Integer.parseInt(min), departureId, departure, arrivalId, arrival));
} }
lastArrival = arrival; lastArrival = arrival;