Package org.goplanit.gtfs.util
Class GtfsConverterReaderHelper
- java.lang.Object
-
- org.goplanit.gtfs.util.GtfsConverterReaderHelper
-
public class GtfsConverterReaderHelper extends Object
Convenience methods usable across various GTFS converter readers
-
-
Constructor Summary
Constructors Constructor Description GtfsConverterReaderHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addToModeExternalId(Mode planitMode, RouteType gtfsMode)
add GTFS type Id to PLANit mode external id (in case multiple GTFS modes are mapped to the same PLANit mode)static HashMap<RouteType,List<Mode>>
createCombinedActivatedPlanitModes(GtfsConverterReaderSettingsWithModeMapping settings, Modes allAvailablePlanitModes)
Based on the settings which define both custom and predefined mappings, we construct the instance mappings from Gtfs mode to PLANit mode, e.g., when a predefined mode type is configured, it results in an instance of that type on a network, this instance should be available in the passed in #allAvailablePlanitMdes, we then combine these mappings with the custom mode mappings on the settings to create a single consolidated set which can be used during parsing without the need of checking whether a mode is predefined or not.static void
syncActivatedPlanitPredefinedModesBeforeParsing(GtfsServicesReaderSettings settings, MacroscopicNetwork network)
Use when it is the time to make sure that the mapped predefined PLANit modes exist as actual mode instances, so supplement the provides modes container where needed based on the configuration.
-
-
-
Method Detail
-
createCombinedActivatedPlanitModes
public static HashMap<RouteType,List<Mode>> createCombinedActivatedPlanitModes(GtfsConverterReaderSettingsWithModeMapping settings, Modes allAvailablePlanitModes)
Based on the settings which define both custom and predefined mappings, we construct the instance mappings from Gtfs mode to PLANit mode, e.g., when a predefined mode type is configured, it results in an instance of that type on a network, this instance should be available in the passed in #allAvailablePlanitMdes, we then combine these mappings with the custom mode mappings on the settings to create a single consolidated set which can be used during parsing without the need of checking whether a mode is predefined or not.- Parameters:
settings
- the settings to obtain the activated two types od mode mappings fromallAvailablePlanitModes
- the mode instances used that should be a superset of the activated mode mappings on the reader- Returns:
- consolidated set of both custom and predefined modes sourced from the allAvailablePlanitModes
-
addToModeExternalId
public static void addToModeExternalId(Mode planitMode, RouteType gtfsMode)
add GTFS type Id to PLANit mode external id (in case multiple GTFS modes are mapped to the same PLANit mode)- Parameters:
planitMode
- to update external id forgtfsMode
- to use
-
syncActivatedPlanitPredefinedModesBeforeParsing
public static void syncActivatedPlanitPredefinedModesBeforeParsing(GtfsServicesReaderSettings settings, MacroscopicNetwork network)
Use when it is the time to make sure that the mapped predefined PLANit modes exist as actual mode instances, so supplement the provides modes container where needed based on the configuration.Also check based on the type of mode (track type, e.g., water/rail,road) that we only do so, if at least one mode exists of the same track type. If not log a warning. For example, if we have activate tram, but no rail based mode layers exist in the network, there is no point in activating, instead log a warning and deactivate on the GTFS settings instead
- Parameters:
settings
- to base modes configuration onnetwork
- to adjust modes for
-
-