Class GtfsServicesReader
- java.lang.Object
-
- org.goplanit.gtfs.converter.service.GtfsServicesReader
-
- All Implemented Interfaces:
ConverterEntity
,PairConverterReader<ServiceNetwork,RoutedServices>
public class GtfsServicesReader extends Object implements PairConverterReader<ServiceNetwork,RoutedServices>
Implementation of a GTFS services reader from GTFS files. This reads the following GTFS files:- routes.txt
- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GtfsServicesReader(MacroscopicNetwork referenceNetwork, GtfsServicesReaderSettings settings)
Constructor where settings are directly provided such that input information can be extracted from itprotected
GtfsServicesReader(IdGroupingToken idToken, MacroscopicNetwork referenceNetwork, GtfsServicesReaderSettings settings)
Constructor where settings are directly provided such that input information can be extracted from it
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
doMainProcessing(GtfsServicesHandlerData fileHandlerData)
Execute the actual parsingFunction<ServiceNode,String>
getServiceNodeToGtfsStopIdMapping()
GTFS Services are ingested and lead to PLANit service nodes to be created based on GTFS stop ids.GtfsServicesReaderSettings
getSettings()
any settings to configure the reader can be configured by collecting these settingsString
getTypeDescription()
short description (one word capitals) of this reader for logging purposesPair<ServiceNetwork,RoutedServices>
read()
parse the network based on the configuration of the implementing class to yield a PLANit networkvoid
reset()
reset the reader to allow for marking unnecessary resources for garbage collection
-
-
-
Constructor Detail
-
GtfsServicesReader
protected GtfsServicesReader(MacroscopicNetwork referenceNetwork, GtfsServicesReaderSettings settings)
Constructor where settings are directly provided such that input information can be extracted from it- Parameters:
referenceNetwork
- to usesettings
- to use
-
GtfsServicesReader
protected GtfsServicesReader(IdGroupingToken idToken, MacroscopicNetwork referenceNetwork, GtfsServicesReaderSettings settings)
Constructor where settings are directly provided such that input information can be extracted from it- Parameters:
idToken
- to use for the routed services and service network idsreferenceNetwork
- to usesettings
- to use
-
-
Method Detail
-
doMainProcessing
protected void doMainProcessing(GtfsServicesHandlerData fileHandlerData)
Execute the actual parsing- Parameters:
fileHandlerData
- containing all data to track and resources needed to perform the processing
-
read
public Pair<ServiceNetwork,RoutedServices> read()
parse the network based on the configuration of the implementing class to yield a PLANit network- Specified by:
read
in interfacePairConverterReader<ServiceNetwork,RoutedServices>
- Returns:
- parsed entities
-
getServiceNodeToGtfsStopIdMapping
public Function<ServiceNode,String> getServiceNodeToGtfsStopIdMapping()
GTFS Services are ingested and lead to PLANit service nodes to be created based on GTFS stop ids. When at some later point in time these PLANit service nodes are to be linked to PLANit transfer zones (which in turn have an association with a GTFS stop) the mapping between PLANit service node and its underlying GTFS stop needs to remain available. This function provides this mapping.For now this mapping is purely based on the external id, but if this changes using this explicit functional approach allows us to change this without having to change the process flow itself
- Returns:
- mapping from PLANit service node to underlying source GTFS stop id
-
getSettings
public GtfsServicesReaderSettings getSettings()
any settings to configure the reader can be configured by collecting these settings- Specified by:
getSettings
in interfacePairConverterReader<ServiceNetwork,RoutedServices>
- Returns:
- the settings to configrue the reader
-
getTypeDescription
public String getTypeDescription()
short description (one word capitals) of this reader for logging purposes- Specified by:
getTypeDescription
in interfaceConverterEntity
- Returns:
- description
-
reset
public void reset()
reset the reader to allow for marking unnecessary resources for garbage collection- Specified by:
reset
in interfaceConverterEntity
-
-