mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-14 08:40:29 +00:00
rename Part to Leg, Part.Trip to Leg.Public and Part.Footway to Leg.Individual
This commit is contained in:
parent
c4939388a4
commit
fde90f7b87
5 changed files with 105 additions and 107 deletions
|
@ -1865,7 +1865,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
XmlPullUtil.next(pp);
|
||||
|
||||
XmlPullUtil.enter(pp, "itdPartialRouteList");
|
||||
final List<Connection.Part> parts = new LinkedList<Connection.Part>();
|
||||
final List<Connection.Leg> legs = new LinkedList<Connection.Leg>();
|
||||
Location firstDepartureLocation = null;
|
||||
Location lastArrivalLocation = null;
|
||||
|
||||
|
@ -1954,17 +1954,17 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
if (XmlPullUtil.test(pp, "itdPathCoordinates"))
|
||||
path = processItdPathCoordinates(pp);
|
||||
|
||||
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
||||
if (legs.size() > 0 && legs.get(legs.size() - 1) instanceof Connection.Individual)
|
||||
{
|
||||
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
||||
if (path != null && lastFootway.path != null)
|
||||
path.addAll(0, lastFootway.path);
|
||||
parts.add(new Connection.Footway(lastFootway.min + min, distance, lastFootway.transfer || transfer,
|
||||
lastFootway.departure, arrivalLocation, path));
|
||||
final Connection.Individual lastIndividualLeg = (Connection.Individual) legs.remove(legs.size() - 1);
|
||||
if (path != null && lastIndividualLeg.path != null)
|
||||
path.addAll(0, lastIndividualLeg.path);
|
||||
legs.add(new Connection.Individual(lastIndividualLeg.min + min, distance, lastIndividualLeg.transfer || transfer,
|
||||
lastIndividualLeg.departure, arrivalLocation, path));
|
||||
}
|
||||
else
|
||||
{
|
||||
parts.add(new Connection.Footway(min, distance, transfer, departureLocation, arrivalLocation, path));
|
||||
legs.add(new Connection.Individual(min, distance, transfer, departureLocation, arrivalLocation, path));
|
||||
}
|
||||
}
|
||||
else if ("gesicherter Anschluss".equals(productName) || "nicht umsteigen".equals(productName)) // type97
|
||||
|
@ -2184,7 +2184,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
final Stop arrival = new Stop(arrivalLocation, false, arrivalTargetTime != null ? arrivalTargetTime : arrivalTime,
|
||||
arrivalTime != null ? arrivalTime : null, arrivalPosition, null);
|
||||
|
||||
parts.add(new Connection.Trip(line, destination, departure, arrival, intermediateStops, path, message));
|
||||
legs.add(new Connection.Public(line, destination, departure, arrival, intermediateStops, path, message));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2253,7 +2253,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider
|
|||
|
||||
XmlPullUtil.exit(pp, "itdRoute");
|
||||
|
||||
final Connection connection = new Connection(id, firstDepartureLocation, lastArrivalLocation, parts, fares.isEmpty() ? null : fares,
|
||||
final Connection connection = new Connection(id, firstDepartureLocation, lastArrivalLocation, legs, fares.isEmpty() ? null : fares,
|
||||
null, numChanges);
|
||||
|
||||
if (!cancelled)
|
||||
|
|
|
@ -1116,7 +1116,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
XmlPullUtil.exit(pp, "Overview");
|
||||
|
||||
final List<Connection.Part> parts = new ArrayList<Connection.Part>(4);
|
||||
final List<Connection.Leg> legs = new ArrayList<Connection.Leg>(4);
|
||||
|
||||
XmlPullUtil.enter(pp, "ConSectionList");
|
||||
|
||||
|
@ -1316,18 +1316,19 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final Stop departure = new Stop(sectionDepartureLocation, true, departureTime, null, departurePos, null);
|
||||
final Stop arrival = new Stop(sectionArrivalLocation, false, arrivalTime, null, arrivalPos, null);
|
||||
|
||||
parts.add(new Connection.Trip(line, destination, departure, arrival, intermediateStops, path, null));
|
||||
legs.add(new Connection.Public(line, destination, departure, arrival, intermediateStops, path, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
||||
if (legs.size() > 0 && legs.get(legs.size() - 1) instanceof Connection.Individual)
|
||||
{
|
||||
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
||||
parts.add(new Connection.Footway(lastFootway.min + min, 0, false, lastFootway.departure, sectionArrivalLocation, null));
|
||||
final Connection.Individual lastIndividualLeg = (Connection.Individual) legs.remove(legs.size() - 1);
|
||||
legs.add(new Connection.Individual(lastIndividualLeg.min + min, 0, false, lastIndividualLeg.departure,
|
||||
sectionArrivalLocation, null));
|
||||
}
|
||||
else
|
||||
{
|
||||
parts.add(new Connection.Footway(min, 0, false, sectionDepartureLocation, sectionArrivalLocation, null));
|
||||
legs.add(new Connection.Individual(min, 0, false, sectionDepartureLocation, sectionArrivalLocation, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1336,7 +1337,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
XmlPullUtil.exit(pp, "Connection");
|
||||
|
||||
connections.add(new Connection(id, departureLocation, arrivalLocation, parts, null, capacity, numTransfers));
|
||||
connections.add(new Connection(id, departureLocation, arrivalLocation, legs, null, capacity, numTransfers));
|
||||
}
|
||||
|
||||
XmlPullUtil.exit(pp);
|
||||
|
@ -1664,8 +1665,8 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
is.skipBytes(0x02);
|
||||
|
||||
final int connectionDetailsIndexOffset = is.readShortReverse();
|
||||
final int connectionDetailsPartOffset = is.readShortReverse();
|
||||
final int connectionDetailsPartSize = is.readShortReverse();
|
||||
final int connectionDetailsLegOffset = is.readShortReverse();
|
||||
final int connectionDetailsLegSize = is.readShortReverse();
|
||||
final int stopsSize = is.readShortReverse();
|
||||
final int stopsOffset = is.readShortReverse();
|
||||
|
||||
|
@ -1700,9 +1701,9 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
|
||||
final int serviceDaysTableOffset = is.readShortReverse();
|
||||
|
||||
final int partsOffset = is.readIntReverse();
|
||||
final int legsOffset = is.readIntReverse();
|
||||
|
||||
final int numParts = is.readShortReverse();
|
||||
final int numLegs = is.readShortReverse();
|
||||
|
||||
final int numChanges = is.readShortReverse();
|
||||
|
||||
|
@ -1764,12 +1765,12 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
final List<Connection.Part> parts = new ArrayList<Connection.Part>(numParts);
|
||||
final List<Connection.Leg> legs = new ArrayList<Connection.Leg>(numLegs);
|
||||
|
||||
for (int iPart = 0; iPart < numParts; iPart++)
|
||||
for (int iLegs = 0; iLegs < numLegs; iLegs++)
|
||||
{
|
||||
is.reset();
|
||||
is.skipBytes(0x4a + partsOffset + iPart * 20);
|
||||
is.skipBytes(0x4a + legsOffset + iLegs * 20);
|
||||
|
||||
final long plannedDepartureTime = time(is, resDate, connectionDayOffset);
|
||||
final Location departureLocation = stations.read(is);
|
||||
|
@ -1784,7 +1785,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
final String plannedDeparturePosition = normalizePosition(strings.read(is));
|
||||
final String plannedArrivalPosition = normalizePosition(strings.read(is));
|
||||
|
||||
final int partAttrIndex = is.readShortReverse();
|
||||
final int legAttrIndex = is.readShortReverse();
|
||||
|
||||
final List<Line.Attr> lineAttrs = new ArrayList<Line.Attr>();
|
||||
String lineComment = null;
|
||||
|
@ -1807,7 +1808,7 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
}
|
||||
|
||||
is.reset();
|
||||
is.skipBytes(attrsOffset + partAttrIndex * 4);
|
||||
is.skipBytes(attrsOffset + legAttrIndex * 4);
|
||||
String directionStr = null;
|
||||
int lineClass = 0;
|
||||
String lineCategory = null;
|
||||
|
@ -1833,10 +1834,10 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
lineCategory = categoryFromName(lineName);
|
||||
|
||||
is.reset();
|
||||
is.skipBytes(connectionDetailsPtr + connectionDetailsOffset + connectionDetailsPartOffset + iPart * connectionDetailsPartSize);
|
||||
is.skipBytes(connectionDetailsPtr + connectionDetailsOffset + connectionDetailsLegOffset + iLegs * connectionDetailsLegSize);
|
||||
|
||||
if (connectionDetailsPartSize != 16)
|
||||
throw new IllegalStateException("unhandled connection details part size: " + connectionDetailsPartSize);
|
||||
if (connectionDetailsLegSize != 16)
|
||||
throw new IllegalStateException("unhandled connection details leg size: " + connectionDetailsLegSize);
|
||||
|
||||
final long predictedDepartureTime = time(is, resDate, connectionDayOffset);
|
||||
final long predictedArrivalTime = time(is, resDate, connectionDayOffset);
|
||||
|
@ -1895,21 +1896,21 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
}
|
||||
}
|
||||
|
||||
final Connection.Part part;
|
||||
final Connection.Leg leg;
|
||||
if (type == 1 /* Fussweg */|| type == 3 /* Uebergang */|| type == 4 /* Uebergang */)
|
||||
{
|
||||
final int min = (int) ((plannedArrivalTime - plannedDepartureTime) / 1000 / 60);
|
||||
final boolean transfer = type != 1;
|
||||
|
||||
if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway)
|
||||
if (legs.size() > 0 && legs.get(legs.size() - 1) instanceof Connection.Individual)
|
||||
{
|
||||
final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1);
|
||||
part = new Connection.Footway(lastFootway.min + min, 0, lastFootway.transfer || transfer, lastFootway.departure,
|
||||
arrivalLocation, null);
|
||||
final Connection.Individual lastIndividualLeg = (Connection.Individual) legs.remove(legs.size() - 1);
|
||||
leg = new Connection.Individual(lastIndividualLeg.min + min, 0, lastIndividualLeg.transfer || transfer,
|
||||
lastIndividualLeg.departure, arrivalLocation, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
part = new Connection.Footway(min, 0, transfer, departureLocation, arrivalLocation, null);
|
||||
leg = new Connection.Individual(min, 0, transfer, departureLocation, arrivalLocation, null);
|
||||
}
|
||||
}
|
||||
else if (type == 2)
|
||||
|
@ -1932,16 +1933,16 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider
|
|||
predictedArrivalTime != 0 ? new Date(predictedArrivalTime) : null, plannedArrivalPosition,
|
||||
predictedArrivalPosition);
|
||||
|
||||
part = new Connection.Trip(line, direction, departure, arrival, intermediateStops, null, null);
|
||||
leg = new Connection.Public(line, direction, departure, arrival, intermediateStops, null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("unhandled type: " + type);
|
||||
}
|
||||
parts.add(part);
|
||||
legs.add(leg);
|
||||
}
|
||||
|
||||
final Connection connection = new Connection(connectionId, resDeparture, resArrival, parts, null, null, (int) numChanges);
|
||||
final Connection connection = new Connection(connectionId, resDeparture, resArrival, legs, null, null, (int) numChanges);
|
||||
|
||||
if (realtimeStatus != 2) // Verbindung fällt aus
|
||||
connections.add(connection);
|
||||
|
|
|
@ -24,9 +24,6 @@ import org.ksoap2.transport.HttpTransportSE;
|
|||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import de.schildbach.pte.dto.Connection;
|
||||
import de.schildbach.pte.dto.Connection.Footway;
|
||||
import de.schildbach.pte.dto.Connection.Part;
|
||||
import de.schildbach.pte.dto.Connection.Trip;
|
||||
import de.schildbach.pte.dto.Fare;
|
||||
import de.schildbach.pte.dto.Fare.Type;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
|
@ -393,13 +390,13 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
}
|
||||
}
|
||||
|
||||
// Get parts of the current connection
|
||||
List<Part> parts = new ArrayList<Part>();
|
||||
// Get legs of the current connection
|
||||
List<Connection.Leg> legs = new ArrayList<Connection.Leg>();
|
||||
Object temp = connection.getProperty("tratti");
|
||||
String networkName = null;
|
||||
if (temp instanceof SoapObject) {
|
||||
SoapObject tratti = (SoapObject) temp;
|
||||
// Go through all connection parts
|
||||
// Go through all connection legs
|
||||
for (int j = 0; j < tratti.getPropertyCount(); j++) {
|
||||
boolean isFootway = false;
|
||||
SoapObject tratto = (SoapObject) tratti.getProperty(j);
|
||||
|
@ -416,15 +413,15 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
}
|
||||
}
|
||||
|
||||
// Add footway to parts list
|
||||
// Add footway to legs list
|
||||
if (isFootway) {
|
||||
// NOTE: path is set to null
|
||||
parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), 0, false,
|
||||
legs.add(new Connection.Individual(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), 0, false,
|
||||
soapToLocation((SoapObject) tratto.getProperty("nodo_partenza")), soapToLocation((SoapObject) tratto
|
||||
.getProperty("nodo_arrivo")), null));
|
||||
}
|
||||
|
||||
// Add trip to parts list
|
||||
// Add trip to legs list
|
||||
else {
|
||||
// Get line ID
|
||||
String lineId = tratto.getPropertyAsString("linea");
|
||||
|
@ -442,7 +439,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
final Stop arrival = new Stop(soapToLocation((SoapObject) tratto.getProperty("nodo_arrivo")), false,
|
||||
responseDate.get(1), null, null, null);
|
||||
|
||||
parts.add(new Trip(new Line(lineId, lineId, DEFAULT_STYLE), null, departure, arrival, null, null, null));
|
||||
legs.add(new Connection.Public(new Line(lineId, lineId, DEFAULT_STYLE), null, departure, arrival, null, null, null));
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -471,7 +468,7 @@ public class SadProvider extends AbstractNetworkProvider {
|
|||
if (fromToLocs.size() == 2) {
|
||||
// NOTE: link, capacity set to null
|
||||
connections.add(new Connection(fromToLocs.get(0).toString() + fromToLocs.get(1).toString(), fromToLocs.get(0),
|
||||
fromToLocs.get(1), parts, fares, null, null));
|
||||
fromToLocs.get(1), legs, fares, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,18 +33,18 @@ public final class Connection implements Serializable
|
|||
private String id;
|
||||
public final Location from;
|
||||
public final Location to;
|
||||
public final List<Part> parts;
|
||||
public final List<Leg> legs;
|
||||
public final List<Fare> fares;
|
||||
public final int[] capacity;
|
||||
public final Integer numChanges;
|
||||
|
||||
public Connection(final String id, final Location from, final Location to, final List<Part> parts, final List<Fare> fares, final int[] capacity,
|
||||
public Connection(final String id, final Location from, final Location to, final List<Leg> legs, final List<Fare> fares, final int[] capacity,
|
||||
final Integer numChanges)
|
||||
{
|
||||
this.id = id;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.parts = parts;
|
||||
this.legs = legs;
|
||||
this.fares = fares;
|
||||
this.capacity = capacity;
|
||||
this.numChanges = numChanges;
|
||||
|
@ -52,78 +52,78 @@ public final class Connection implements Serializable
|
|||
|
||||
public Date getFirstDepartureTime()
|
||||
{
|
||||
if (parts != null)
|
||||
if (legs != null)
|
||||
{
|
||||
int mins = 0;
|
||||
for (final Part part : parts)
|
||||
for (final Leg leg : legs)
|
||||
{
|
||||
if (part instanceof Footway)
|
||||
mins += ((Footway) part).min;
|
||||
else if (part instanceof Trip)
|
||||
return new Date(((Trip) part).getDepartureTime().getTime() - 1000 * 60 * mins);
|
||||
if (leg instanceof Individual)
|
||||
mins += ((Individual) leg).min;
|
||||
else if (leg instanceof Public)
|
||||
return new Date(((Public) leg).getDepartureTime().getTime() - 1000 * 60 * mins);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Trip getFirstTrip()
|
||||
public Public getFirstPublicLeg()
|
||||
{
|
||||
if (parts != null)
|
||||
for (final Part part : parts)
|
||||
if (part instanceof Trip)
|
||||
return (Trip) part;
|
||||
if (legs != null)
|
||||
for (final Leg leg : legs)
|
||||
if (leg instanceof Public)
|
||||
return (Public) leg;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Date getFirstTripDepartureTime()
|
||||
public Date getFirstPublicLegDepartureTime()
|
||||
{
|
||||
final Trip firstTrip = getFirstTrip();
|
||||
if (firstTrip != null)
|
||||
return firstTrip.getDepartureTime();
|
||||
final Public firstPublicLeg = getFirstPublicLeg();
|
||||
if (firstPublicLeg != null)
|
||||
return firstPublicLeg.getDepartureTime();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public Date getLastArrivalTime()
|
||||
{
|
||||
if (parts != null)
|
||||
if (legs != null)
|
||||
{
|
||||
int mins = 0;
|
||||
for (int i = parts.size() - 1; i >= 0; i--)
|
||||
for (int i = legs.size() - 1; i >= 0; i--)
|
||||
{
|
||||
final Part part = parts.get(i);
|
||||
if (part instanceof Footway)
|
||||
mins += ((Footway) part).min;
|
||||
else if (part instanceof Trip)
|
||||
return new Date(((Trip) part).getArrivalTime().getTime() + 1000 * 60 * mins);
|
||||
final Leg leg = legs.get(i);
|
||||
if (leg instanceof Individual)
|
||||
mins += ((Individual) leg).min;
|
||||
else if (leg instanceof Public)
|
||||
return new Date(((Public) leg).getArrivalTime().getTime() + 1000 * 60 * mins);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Trip getLastTrip()
|
||||
public Public getLastPublicLeg()
|
||||
{
|
||||
if (parts != null)
|
||||
if (legs != null)
|
||||
{
|
||||
for (int i = parts.size() - 1; i >= 0; i--)
|
||||
for (int i = legs.size() - 1; i >= 0; i--)
|
||||
{
|
||||
final Part part = parts.get(i);
|
||||
if (part instanceof Trip)
|
||||
return (Trip) part;
|
||||
final Leg leg = legs.get(i);
|
||||
if (leg instanceof Public)
|
||||
return (Public) leg;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Date getLastTripArrivalTime()
|
||||
public Date getLastPublicLegArrivalTime()
|
||||
{
|
||||
final Trip lastTrip = getLastTrip();
|
||||
if (lastTrip != null)
|
||||
return lastTrip.getArrivalTime();
|
||||
final Public lastPublicLeg = getLastPublicLeg();
|
||||
if (lastPublicLeg != null)
|
||||
return lastPublicLeg.getArrivalTime();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
@ -140,23 +140,23 @@ public final class Connection implements Serializable
|
|||
{
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
if (parts != null && parts.size() > 0)
|
||||
if (legs != null && legs.size() > 0)
|
||||
{
|
||||
for (final Part part : parts)
|
||||
for (final Leg leg : legs)
|
||||
{
|
||||
builder.append(part.departure.hasId() ? part.departure.id : part.departure.lat + '/' + part.departure.lon).append('-');
|
||||
builder.append(part.arrival.hasId() ? part.arrival.id : part.arrival.lat + '/' + part.arrival.lon).append('-');
|
||||
builder.append(leg.departure.hasId() ? leg.departure.id : leg.departure.lat + '/' + leg.departure.lon).append('-');
|
||||
builder.append(leg.arrival.hasId() ? leg.arrival.id : leg.arrival.lat + '/' + leg.arrival.lon).append('-');
|
||||
|
||||
if (part instanceof Footway)
|
||||
if (leg instanceof Individual)
|
||||
{
|
||||
builder.append(((Footway) part).min);
|
||||
builder.append(((Individual) leg).min);
|
||||
}
|
||||
else if (part instanceof Trip)
|
||||
else if (leg instanceof Public)
|
||||
{
|
||||
final Trip trip = (Trip) part;
|
||||
builder.append(trip.departureStop.plannedDepartureTime.getTime()).append('-');
|
||||
builder.append(trip.arrivalStop.plannedArrivalTime.getTime()).append('-');
|
||||
builder.append(trip.line.label);
|
||||
final Public publicLeg = (Public) leg;
|
||||
builder.append(publicLeg.departureStop.plannedDepartureTime.getTime()).append('-');
|
||||
builder.append(publicLeg.arrivalStop.plannedArrivalTime.getTime()).append('-');
|
||||
builder.append(publicLeg.line.label);
|
||||
}
|
||||
|
||||
builder.append('|');
|
||||
|
@ -175,11 +175,11 @@ public final class Connection implements Serializable
|
|||
|
||||
final StringBuilder str = new StringBuilder(getId());
|
||||
str.append(' ');
|
||||
final Date firstTripDepartureTime = getFirstTripDepartureTime();
|
||||
str.append(firstTripDepartureTime != null ? FORMAT.format(firstTripDepartureTime) : "null");
|
||||
final Date firstPublicLegDepartureTime = getFirstPublicLegDepartureTime();
|
||||
str.append(firstPublicLegDepartureTime != null ? FORMAT.format(firstPublicLegDepartureTime) : "null");
|
||||
str.append('-');
|
||||
final Date lastTripArrivalTime = getLastTripArrivalTime();
|
||||
str.append(lastTripArrivalTime != null ? FORMAT.format(lastTripArrivalTime) : "null");
|
||||
final Date lastPublicLegArrivalTime = getLastPublicLegArrivalTime();
|
||||
str.append(lastPublicLegArrivalTime != null ? FORMAT.format(lastPublicLegArrivalTime) : "null");
|
||||
str.append(' ').append(numChanges).append("ch");
|
||||
|
||||
return str.toString();
|
||||
|
@ -202,7 +202,7 @@ public final class Connection implements Serializable
|
|||
return getId().hashCode();
|
||||
}
|
||||
|
||||
public static class Part implements Serializable
|
||||
public static class Leg implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 8498461220084523265L;
|
||||
|
||||
|
@ -210,7 +210,7 @@ public final class Connection implements Serializable
|
|||
public final Location arrival;
|
||||
public List<Point> path;
|
||||
|
||||
public Part(final Location departure, final Location arrival, final List<Point> path)
|
||||
public Leg(final Location departure, final Location arrival, final List<Point> path)
|
||||
{
|
||||
this.departure = departure;
|
||||
this.arrival = arrival;
|
||||
|
@ -218,7 +218,7 @@ public final class Connection implements Serializable
|
|||
}
|
||||
}
|
||||
|
||||
public final static class Trip extends Part
|
||||
public final static class Public extends Leg
|
||||
{
|
||||
private static final long serialVersionUID = 1312066446239817422L;
|
||||
|
||||
|
@ -229,7 +229,7 @@ public final class Connection implements Serializable
|
|||
public final List<Stop> intermediateStops;
|
||||
public final String message;
|
||||
|
||||
public Trip(final Line line, final Location destination, final Stop departureStop, final Stop arrivalStop,
|
||||
public Public(final Line line, final Location destination, final Stop departureStop, final Stop arrivalStop,
|
||||
final List<Stop> intermediateStops, final List<Point> path, final String message)
|
||||
{
|
||||
super(departureStop != null ? departureStop.location : null, arrivalStop != null ? arrivalStop.location : null, path);
|
||||
|
@ -321,7 +321,7 @@ public final class Connection implements Serializable
|
|||
}
|
||||
}
|
||||
|
||||
public final static class Footway extends Part
|
||||
public final static class Individual extends Leg
|
||||
{
|
||||
private static final long serialVersionUID = -6651381862837233925L;
|
||||
|
||||
|
@ -329,7 +329,7 @@ public final class Connection implements Serializable
|
|||
public final int distance;
|
||||
public final boolean transfer;
|
||||
|
||||
public Footway(final int min, final int distance, final boolean transfer, final Location departure, final Location arrival,
|
||||
public Individual(final int min, final int distance, final boolean transfer, final Location departure, final Location arrival,
|
||||
final List<Point> path)
|
||||
{
|
||||
super(departure, arrival, path);
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.List;
|
|||
import org.junit.Test;
|
||||
|
||||
import de.schildbach.pte.SadProvider;
|
||||
import de.schildbach.pte.dto.Connection.Footway;
|
||||
import de.schildbach.pte.dto.Connection.Individual;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.QueryConnectionsResult;
|
||||
|
@ -92,7 +92,7 @@ public class SadProviderLiveTest extends AbstractProviderLiveTest {
|
|||
|
||||
assertFalse(result.connections.isEmpty());
|
||||
|
||||
assertTrue(result.connections.get(0).parts.get(0) instanceof Footway);
|
||||
assertTrue(result.connections.get(0).legs.get(0) instanceof Individual);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue