From ad6d8b19cd826171d8dc75d3bc774d1ed485d38d Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Fri, 10 Aug 2012 14:04:11 +0200 Subject: [PATCH] distinguish between footway and transfer --- enabler/src/de/schildbach/pte/AbstractEfaProvider.java | 6 ++++-- .../src/de/schildbach/pte/AbstractHafasProvider.java | 10 ++++++---- enabler/src/de/schildbach/pte/SadProvider.java | 2 +- enabler/src/de/schildbach/pte/dto/Connection.java | 10 ++++++++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java index 7fc2e3e7..51ad3422 100644 --- a/enabler/src/de/schildbach/pte/AbstractEfaProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractEfaProvider.java @@ -1969,6 +1969,7 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider if ("Fussweg".equals(productName) || "Taxi".equals(productName)) { final int min = (int) (arrivalTime.getTime() - departureTime.getTime()) / 1000 / 60; + final boolean transfer = "Taxi".equals(productName); XmlPullUtil.enter(pp, "itdMeansOfTransport"); XmlPullUtil.exit(pp, "itdMeansOfTransport"); @@ -1988,11 +1989,12 @@ public abstract class AbstractEfaProvider extends AbstractNetworkProvider 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, lastFootway.departure, arrival, path)); + parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, arrival, + path)); } else { - parts.add(new Connection.Footway(min, departure, arrival, path)); + parts.add(new Connection.Footway(min, transfer, departure, arrival, path)); } } else if ("gesicherter Anschluss".equals(productName) || "nicht umsteigen".equals(productName)) // type97 diff --git a/enabler/src/de/schildbach/pte/AbstractHafasProvider.java b/enabler/src/de/schildbach/pte/AbstractHafasProvider.java index e3e05ddd..d89bd10e 100644 --- a/enabler/src/de/schildbach/pte/AbstractHafasProvider.java +++ b/enabler/src/de/schildbach/pte/AbstractHafasProvider.java @@ -1273,11 +1273,11 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider if (parts.size() > 0 && parts.get(parts.size() - 1) instanceof Connection.Footway) { final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); - parts.add(new Connection.Footway(lastFootway.min + min, lastFootway.departure, sectionArrival, null)); + parts.add(new Connection.Footway(lastFootway.min + min, false, lastFootway.departure, sectionArrival, null)); } else { - parts.add(new Connection.Footway(min, sectionDeparture, sectionArrival, null)); + parts.add(new Connection.Footway(min, false, sectionDeparture, sectionArrival, null)); } } } @@ -1812,15 +1812,17 @@ public abstract class AbstractHafasProvider extends AbstractNetworkProvider 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) { final Connection.Footway lastFootway = (Connection.Footway) parts.remove(parts.size() - 1); - part = new Connection.Footway(lastFootway.min + min, lastFootway.departure, arrival, null); + part = new Connection.Footway(lastFootway.min + min, lastFootway.transfer || transfer, lastFootway.departure, arrival, + null); } else { - part = new Connection.Footway(min, departure, arrival, null); + part = new Connection.Footway(min, transfer, departure, arrival, null); } } diff --git a/enabler/src/de/schildbach/pte/SadProvider.java b/enabler/src/de/schildbach/pte/SadProvider.java index 3189595f..715122b3 100644 --- a/enabler/src/de/schildbach/pte/SadProvider.java +++ b/enabler/src/de/schildbach/pte/SadProvider.java @@ -416,7 +416,7 @@ public class SadProvider extends AbstractNetworkProvider { // Add footway to parts list if (isFootway) { // NOTE: path is set to null - parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), + parts.add(new Footway(Integer.parseInt(tratto.getPropertyAsString("durata").split(":")[1]), false, soapToLocation((SoapObject) tratto.getProperty("nodo_partenza")), soapToLocation((SoapObject) tratto .getProperty("nodo_arrivo")), null)); } diff --git a/enabler/src/de/schildbach/pte/dto/Connection.java b/enabler/src/de/schildbach/pte/dto/Connection.java index 106253e4..ed9a6bc9 100644 --- a/enabler/src/de/schildbach/pte/dto/Connection.java +++ b/enabler/src/de/schildbach/pte/dto/Connection.java @@ -350,13 +350,17 @@ public final class Connection implements Serializable public final static class Footway extends Part { - public final int min; + private static final long serialVersionUID = -6651381862837233925L; - public Footway(final int min, final Location departure, final Location arrival, final List path) + public final int min; + public final boolean transfer; + + public Footway(final int min, final boolean transfer, final Location departure, final Location arrival, final List path) { super(departure, arrival, path); this.min = min; + this.transfer = transfer; } @Override @@ -365,6 +369,8 @@ public final class Connection implements Serializable final StringBuilder builder = new StringBuilder(getClass().getName() + "["); builder.append("min=").append(min); builder.append(","); + builder.append("transfer=").append(transfer); + builder.append(","); builder.append("departure=").append(departure.toDebugString()); builder.append(","); builder.append("arrival=").append(arrival.toDebugString());