Skip to content

Commit

Permalink
Review:
Browse files Browse the repository at this point in the history
  - Rename GTFSPatternHopFactory to PatternHopFactory
  - Rename method mapDao(...) to mapGtfsDaoToOTPTransitService(...)
  - Rename OtpTransitDaoMapper to GTFSToOtpTransitServiceMapper
  - Rename OtpTransitBuilder to OtpTransitServiceBuilder
  - Rename GTFSPatternHopFactory to PatternHopFactory
  - Add JavaDoc to all mapper classes and OtpTransitServiceBuilder
  - Cleanup JavaDoc in OtpTransitServiceImpl
  - Delete InterliningTrip (not used in PatternHopFactory)
  • Loading branch information
t2gran committed Aug 16, 2018
1 parent 34736a5 commit b2a74a9
Show file tree
Hide file tree
Showing 41 changed files with 121 additions and 108 deletions.
Expand Up @@ -34,7 +34,7 @@
import org.opentripplanner.gtfs.GtfsContext; import org.opentripplanner.gtfs.GtfsContext;
import org.opentripplanner.gtfs.GtfsLibrary; import org.opentripplanner.gtfs.GtfsLibrary;
import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.OtpTransitService;
import org.opentripplanner.routing.edgetype.factory.GTFSPatternHopFactory; import org.opentripplanner.routing.edgetype.factory.PatternHopFactory;
import org.opentripplanner.routing.edgetype.factory.GtfsStopContext; import org.opentripplanner.routing.edgetype.factory.GtfsStopContext;
import org.opentripplanner.routing.graph.Graph; import org.opentripplanner.routing.graph.Graph;
import org.opentripplanner.routing.services.FareServiceFactory; import org.opentripplanner.routing.services.FareServiceFactory;
Expand All @@ -44,7 +44,7 @@
import com.google.common.collect.Sets; import com.google.common.collect.Sets;


import static org.opentripplanner.calendar.impl.CalendarServiceDataFactoryImpl.createCalendarSrvDataWithoutDatesForLocalizedSrvId; import static org.opentripplanner.calendar.impl.CalendarServiceDataFactoryImpl.createCalendarSrvDataWithoutDatesForLocalizedSrvId;
import static org.opentripplanner.gtfs.mapping.OtpTransitDaoMapper.mapDao; import static org.opentripplanner.gtfs.mapping.GTFSToOtpTransitServiceMapper.mapGtfsDaoToOTPTransitService;


public class GtfsModule implements GraphBuilderModule { public class GtfsModule implements GraphBuilderModule {


Expand Down Expand Up @@ -105,12 +105,12 @@ public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) {
gtfsBundle.useCached = useCached; gtfsBundle.useCached = useCached;
} }


OtpTransitService transitService = mapDao(loadBundle(gtfsBundle)); OtpTransitService transitService = mapGtfsDaoToOTPTransitService(loadBundle(gtfsBundle));


GtfsContext context = GtfsLibrary GtfsContext context = GtfsLibrary
.createContext(gtfsBundle.getFeedId(), transitService, calendarService); .createContext(gtfsBundle.getFeedId(), transitService, calendarService);


GTFSPatternHopFactory hf = new GTFSPatternHopFactory(context); PatternHopFactory hf = new PatternHopFactory(context);


hf.setStopContext(stopContext); hf.setStopContext(stopContext);
hf.setFareServiceFactory(fareServiceFactory); hf.setFareServiceFactory(fareServiceFactory);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/opentripplanner/gtfs/GtfsLibrary.java
@@ -1,7 +1,7 @@
package org.opentripplanner.gtfs; package org.opentripplanner.gtfs;


import org.opentripplanner.graph_builder.module.GtfsFeedId; import org.opentripplanner.graph_builder.module.GtfsFeedId;
import org.opentripplanner.gtfs.mapping.OtpTransitDaoMapper; import org.opentripplanner.gtfs.mapping.GTFSToOtpTransitServiceMapper;
import org.opentripplanner.model.FeedId; import org.opentripplanner.model.FeedId;
import org.opentripplanner.model.CalendarService; import org.opentripplanner.model.CalendarService;
import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.OtpTransitService;
Expand Down Expand Up @@ -31,7 +31,7 @@ public static GtfsContext readGtfs(File path) throws IOException {
GtfsImport gtfsImport = new GtfsImport(path); GtfsImport gtfsImport = new GtfsImport(path);


GtfsFeedId feedId = gtfsImport.getFeedId(); GtfsFeedId feedId = gtfsImport.getFeedId();
OtpTransitService transitService = OtpTransitDaoMapper.mapDao(gtfsImport.getDao()); OtpTransitService transitService = GTFSToOtpTransitServiceMapper.mapGtfsDaoToOTPTransitService(gtfsImport.getDao());
CalendarService calendarService = createCalendarService(transitService); CalendarService calendarService = createCalendarService(transitService);


return new GtfsContextImpl(feedId, transitService, calendarService); return new GtfsContextImpl(feedId, transitService, calendarService);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/opentripplanner/gtfs/MockGtfs.java
Expand Up @@ -2,7 +2,7 @@


import org.opentripplanner.model.FeedId; import org.opentripplanner.model.FeedId;
import org.opentripplanner.gtfs.mapping.AgencyAndIdMapper; import org.opentripplanner.gtfs.mapping.AgencyAndIdMapper;
import org.opentripplanner.gtfs.mapping.OtpTransitDaoMapper; import org.opentripplanner.gtfs.mapping.GTFSToOtpTransitServiceMapper;
import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.OtpTransitService;


import java.io.File; import java.io.File;
Expand Down Expand Up @@ -41,11 +41,11 @@ public void putLines(String fileName, String... rows) {
} }


public OtpTransitService read() throws IOException { public OtpTransitService read() throws IOException {
return OtpTransitDaoMapper.mapDao(gtfsDelegate.read()); return GTFSToOtpTransitServiceMapper.mapGtfsDaoToOTPTransitService(gtfsDelegate.read());
} }


public OtpTransitService read(org.onebusaway.gtfs.serialization.GtfsReader reader) throws IOException { public OtpTransitService read(org.onebusaway.gtfs.serialization.GtfsReader reader) throws IOException {
return OtpTransitDaoMapper.mapDao(gtfsDelegate.read(reader)); return GTFSToOtpTransitServiceMapper.mapGtfsDaoToOTPTransitService(gtfsDelegate.read(reader));
} }


public void putMinimal() { public void putMinimal() {
Expand Down
Expand Up @@ -2,7 +2,10 @@


import org.opentripplanner.model.FeedId; import org.opentripplanner.model.FeedId;


/** Responsible for mapping GTFS AgencyAndId into the OTP model. */
public class AgencyAndIdMapper { public class AgencyAndIdMapper {

/** Map from GTFS to OTP model, {@code null} safe. */
public static FeedId mapAgencyAndId(org.onebusaway.gtfs.model.AgencyAndId id) { public static FeedId mapAgencyAndId(org.onebusaway.gtfs.model.AgencyAndId id) {
return id == null ? null : new FeedId(id.getAgencyId(), id.getId()); return id == null ? null : new FeedId(id.getAgencyId(), id.getId());
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS Agency into the OTP model. */
class AgencyMapper { class AgencyMapper {


private final Map<org.onebusaway.gtfs.model.Agency, Agency> mappedAgencies = new HashMap<>(); private final Map<org.onebusaway.gtfs.model.Agency, Agency> mappedAgencies = new HashMap<>();
Expand All @@ -15,6 +16,7 @@ Collection<Agency> map(Collection<org.onebusaway.gtfs.model.Agency> agencies) {
return MapUtils.mapToList(agencies, this::map); return MapUtils.mapToList(agencies, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Agency map(org.onebusaway.gtfs.model.Agency orginal) { Agency map(org.onebusaway.gtfs.model.Agency orginal) {
return orginal == null ? null : mappedAgencies.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedAgencies.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -9,13 +9,15 @@


import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId; import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId;


/** Responsible for mapping GTFS FareAttribute into the OTP model. */
class FareAttributeMapper { class FareAttributeMapper {
private Map<org.onebusaway.gtfs.model.FareAttribute, FareAttribute> mappedStops = new HashMap<>(); private Map<org.onebusaway.gtfs.model.FareAttribute, FareAttribute> mappedStops = new HashMap<>();


Collection<FareAttribute> map(Collection<org.onebusaway.gtfs.model.FareAttribute> allStops) { Collection<FareAttribute> map(Collection<org.onebusaway.gtfs.model.FareAttribute> allStops) {
return MapUtils.mapToList(allStops, this::map); return MapUtils.mapToList(allStops, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
FareAttribute map(org.onebusaway.gtfs.model.FareAttribute orginal) { FareAttribute map(org.onebusaway.gtfs.model.FareAttribute orginal) {
return orginal == null ? null : mappedStops.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedStops.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS FareRule into the OTP model. */
class FareRuleMapper { class FareRuleMapper {


private final RouteMapper routeMapper; private final RouteMapper routeMapper;
Expand All @@ -24,6 +25,7 @@ Collection<FareRule> map(Collection<org.onebusaway.gtfs.model.FareRule> allFareR
return MapUtils.mapToList(allFareRules, this::map); return MapUtils.mapToList(allFareRules, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
FareRule map(org.onebusaway.gtfs.model.FareRule orginal) { FareRule map(org.onebusaway.gtfs.model.FareRule orginal) {
return orginal == null ? null : mappedFareRules.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedFareRules.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -9,13 +9,15 @@


import static org.opentripplanner.gtfs.mapping.ServiceDateMapper.mapServiceDate; import static org.opentripplanner.gtfs.mapping.ServiceDateMapper.mapServiceDate;


/** Responsible for mapping GTFS FeedInfo into the OTP model. */
class FeedInfoMapper { class FeedInfoMapper {
private Map<org.onebusaway.gtfs.model.FeedInfo, FeedInfo> mappedFeedInfos = new HashMap<>(); private Map<org.onebusaway.gtfs.model.FeedInfo, FeedInfo> mappedFeedInfos = new HashMap<>();


Collection<FeedInfo> map(Collection<org.onebusaway.gtfs.model.FeedInfo> feedInfos) { Collection<FeedInfo> map(Collection<org.onebusaway.gtfs.model.FeedInfo> feedInfos) {
return feedInfos == null ? null : MapUtils.mapToList(feedInfos, this::map); return feedInfos == null ? null : MapUtils.mapToList(feedInfos, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
FeedInfo map(org.onebusaway.gtfs.model.FeedInfo orginal) { FeedInfo map(org.onebusaway.gtfs.model.FeedInfo orginal) {
return orginal == null ? null : mappedFeedInfos.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedFeedInfos.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS Frequency into the OTP model. */
class FrequencyMapper { class FrequencyMapper {
private final TripMapper tripMapper; private final TripMapper tripMapper;


Expand All @@ -20,6 +21,7 @@ Collection<Frequency> map(Collection<org.onebusaway.gtfs.model.Frequency> allFre
return MapUtils.mapToList(allFrequencys, this::map); return MapUtils.mapToList(allFrequencys, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Frequency map(org.onebusaway.gtfs.model.Frequency orginal) { Frequency map(org.onebusaway.gtfs.model.Frequency orginal) {
return orginal == null ? null : mappedFrequencys.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedFrequencys.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
@@ -1,9 +1,15 @@
package org.opentripplanner.gtfs.mapping; package org.opentripplanner.gtfs.mapping;


import org.opentripplanner.model.impl.OtpTransitBuilder; import org.opentripplanner.model.impl.OtpTransitServiceBuilder;
import org.opentripplanner.model.OtpTransitService; import org.opentripplanner.model.OtpTransitService;


public class OtpTransitDaoMapper {
/**
* This class is responsible for mapping between GTFS DAO objects and into OTP Transit model.
* General mapping code or reusable bussiness logic should be moved into the Builder; hence
* reusable for other import modules.
*/
public class GTFSToOtpTransitServiceMapper {
private final AgencyMapper agencyMapper = new AgencyMapper(); private final AgencyMapper agencyMapper = new AgencyMapper();


private final StopMapper stopMapper = new StopMapper(); private final StopMapper stopMapper = new StopMapper();
Expand Down Expand Up @@ -36,12 +42,15 @@ public class OtpTransitDaoMapper {
routeMapper, fareAttributeMapper routeMapper, fareAttributeMapper
); );


public static OtpTransitService mapDao(org.onebusaway.gtfs.services.GtfsRelationalDao data) { /**
return new OtpTransitDaoMapper().map(data); * Map from GTFS data to the internal OTP model
*/
public static OtpTransitService mapGtfsDaoToOTPTransitService(org.onebusaway.gtfs.services.GtfsRelationalDao data) {
return new GTFSToOtpTransitServiceMapper().map(data);
} }


private OtpTransitService map(org.onebusaway.gtfs.services.GtfsRelationalDao data) { private OtpTransitService map(org.onebusaway.gtfs.services.GtfsRelationalDao data) {
OtpTransitBuilder builder = new OtpTransitBuilder(); OtpTransitServiceBuilder builder = new OtpTransitServiceBuilder();


builder.getAgencies().addAll(agencyMapper.map(data.getAllAgencies())); builder.getAgencies().addAll(agencyMapper.map(data.getAllAgencies()));
builder.getCalendarDates().addAll(serviceCalendarDateMapper.map(data.getAllCalendarDates())); builder.getCalendarDates().addAll(serviceCalendarDateMapper.map(data.getAllCalendarDates()));
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS Pathway into the OTP model. */
class PathwayMapper { class PathwayMapper {


private final StopMapper stopMapper; private final StopMapper stopMapper;
Expand All @@ -21,6 +22,7 @@ Collection<Pathway> map(Collection<org.onebusaway.gtfs.model.Pathway> allPathway
return MapUtils.mapToList(allPathways, this::map); return MapUtils.mapToList(allPathways, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Pathway map(org.onebusaway.gtfs.model.Pathway orginal) { Pathway map(org.onebusaway.gtfs.model.Pathway orginal) {
return orginal == null ? null : mappedPathways.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedPathways.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS Route into the OTP model. */
class RouteMapper { class RouteMapper {
private final AgencyMapper agencyMapper; private final AgencyMapper agencyMapper;


Expand All @@ -20,6 +21,7 @@ Collection<Route> map(Collection<org.onebusaway.gtfs.model.Route> agencies) {
return MapUtils.mapToList(agencies, this::map); return MapUtils.mapToList(agencies, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Route map(org.onebusaway.gtfs.model.Route orginal) { Route map(org.onebusaway.gtfs.model.Route orginal) {
return orginal == null ? null : mappedRoutes.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedRoutes.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS ServiceCalendarDate into the OTP model. */
class ServiceCalendarDateMapper { class ServiceCalendarDateMapper {
private Map<org.onebusaway.gtfs.model.ServiceCalendarDate, ServiceCalendarDate> mappedServiceDates = new HashMap<>(); private Map<org.onebusaway.gtfs.model.ServiceCalendarDate, ServiceCalendarDate> mappedServiceDates = new HashMap<>();


Expand All @@ -15,6 +16,7 @@ Collection<ServiceCalendarDate> map(
return MapUtils.mapToList(allServiceDates, this::map); return MapUtils.mapToList(allServiceDates, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
ServiceCalendarDate map(org.onebusaway.gtfs.model.ServiceCalendarDate orginal) { ServiceCalendarDate map(org.onebusaway.gtfs.model.ServiceCalendarDate orginal) {
return orginal == null ? null : mappedServiceDates.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedServiceDates.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -9,6 +9,7 @@


import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId; import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId;


/** Responsible for mapping GTFS ServiceCalendar into the OTP model. */
class ServiceCalendarMapper { class ServiceCalendarMapper {
private Map<org.onebusaway.gtfs.model.ServiceCalendar, ServiceCalendar> mappedCalendars = new HashMap<>(); private Map<org.onebusaway.gtfs.model.ServiceCalendar, ServiceCalendar> mappedCalendars = new HashMap<>();


Expand All @@ -17,6 +18,7 @@ Collection<ServiceCalendar> map(
return MapUtils.mapToList(allServiceCalendars, this::map); return MapUtils.mapToList(allServiceCalendars, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
ServiceCalendar map(org.onebusaway.gtfs.model.ServiceCalendar orginal) { ServiceCalendar map(org.onebusaway.gtfs.model.ServiceCalendar orginal) {
return orginal == null ? null : mappedCalendars.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedCalendars.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -2,7 +2,9 @@


import org.opentripplanner.model.calendar.ServiceDate; import org.opentripplanner.model.calendar.ServiceDate;


/** Responsible for mapping GTFS ServiceDate into the OTP model. */
class ServiceDateMapper { class ServiceDateMapper {
/** Map from GTFS to OTP model, {@code null} safe. */
static ServiceDate mapServiceDate(org.onebusaway.gtfs.model.calendar.ServiceDate orginal) { static ServiceDate mapServiceDate(org.onebusaway.gtfs.model.calendar.ServiceDate orginal) {
return orginal == null ? return orginal == null ?
null : null :
Expand Down
Expand Up @@ -7,13 +7,15 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS ShapePoint into the OTP model. */
class ShapePointMapper { class ShapePointMapper {
private Map<org.onebusaway.gtfs.model.ShapePoint, ShapePoint> mappedShapePoints = new HashMap<>(); private Map<org.onebusaway.gtfs.model.ShapePoint, ShapePoint> mappedShapePoints = new HashMap<>();


Collection<ShapePoint> map(Collection<org.onebusaway.gtfs.model.ShapePoint> allShapePoints) { Collection<ShapePoint> map(Collection<org.onebusaway.gtfs.model.ShapePoint> allShapePoints) {
return MapUtils.mapToList(allShapePoints, this::map); return MapUtils.mapToList(allShapePoints, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
ShapePoint map(org.onebusaway.gtfs.model.ShapePoint orginal) { ShapePoint map(org.onebusaway.gtfs.model.ShapePoint orginal) {
return orginal == null ? null : mappedShapePoints.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedShapePoints.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -9,13 +9,15 @@


import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId; import static org.opentripplanner.gtfs.mapping.AgencyAndIdMapper.mapAgencyAndId;


/** Responsible for mapping GTFS Stop into the OTP model. */
class StopMapper { class StopMapper {
private Map<org.onebusaway.gtfs.model.Stop, Stop> mappedStops = new HashMap<>(); private Map<org.onebusaway.gtfs.model.Stop, Stop> mappedStops = new HashMap<>();


Collection<Stop> map(Collection<org.onebusaway.gtfs.model.Stop> allStops) { Collection<Stop> map(Collection<org.onebusaway.gtfs.model.Stop> allStops) {
return MapUtils.mapToList(allStops, this::map); return MapUtils.mapToList(allStops, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Stop map(org.onebusaway.gtfs.model.Stop orginal) { Stop map(org.onebusaway.gtfs.model.Stop orginal) {
return orginal == null ? null : mappedStops.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedStops.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS StopTime into the OTP model. */
class StopTimeMapper { class StopTimeMapper {
private final StopMapper stopMapper; private final StopMapper stopMapper;


Expand All @@ -23,6 +24,7 @@ Collection<StopTime> map(Collection<org.onebusaway.gtfs.model.StopTime> times) {
return MapUtils.mapToList(times, this::map); return MapUtils.mapToList(times, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
StopTime map(org.onebusaway.gtfs.model.StopTime orginal) { StopTime map(org.onebusaway.gtfs.model.StopTime orginal) {
return orginal == null ? null : mappedStopTimes.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedStopTimes.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS Transfer into the OTP model. */
class TransferMapper { class TransferMapper {
private final RouteMapper routeMapper; private final RouteMapper routeMapper;


Expand All @@ -16,7 +17,7 @@ class TransferMapper {


private Map<org.onebusaway.gtfs.model.Transfer, Transfer> mappedTransfers = new HashMap<>(); private Map<org.onebusaway.gtfs.model.Transfer, Transfer> mappedTransfers = new HashMap<>();


public TransferMapper(RouteMapper routeMapper, StopMapper stopMapper, TripMapper tripMapper) { TransferMapper(RouteMapper routeMapper, StopMapper stopMapper, TripMapper tripMapper) {
this.routeMapper = routeMapper; this.routeMapper = routeMapper;
this.stopMapper = stopMapper; this.stopMapper = stopMapper;
this.tripMapper = tripMapper; this.tripMapper = tripMapper;
Expand All @@ -26,6 +27,7 @@ Collection<Transfer> map(Collection<org.onebusaway.gtfs.model.Transfer> allTrans
return MapUtils.mapToList(allTransfers, this::map); return MapUtils.mapToList(allTransfers, this::map);
} }


/** Map from GTFS to OTP model, {@code null} safe. */
Transfer map(org.onebusaway.gtfs.model.Transfer orginal) { Transfer map(org.onebusaway.gtfs.model.Transfer orginal) {
return orginal == null ? null : mappedTransfers.computeIfAbsent(orginal, this::doMap); return orginal == null ? null : mappedTransfers.computeIfAbsent(orginal, this::doMap);
} }
Expand Down
Expand Up @@ -7,6 +7,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


/** Responsible for mapping GTFS TripMapper into the OTP model. */
class TripMapper { class TripMapper {


private final RouteMapper routeMapper; private final RouteMapper routeMapper;
Expand Down
Expand Up @@ -3,11 +3,11 @@


import org.opentripplanner.model.FeedId; import org.opentripplanner.model.FeedId;


public class MultipleCalendarsForServiceIdException extends RuntimeException { class MultipleCalendarsForServiceIdException extends RuntimeException {


private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;


public MultipleCalendarsForServiceIdException(FeedId serviceId) { MultipleCalendarsForServiceIdException(FeedId serviceId) {
super("multiple calendars found for serviceId=" + serviceId); super("multiple calendars found for serviceId=" + serviceId);
} }
} }

0 comments on commit b2a74a9

Please sign in to comment.