Class GtfsServicesReaderSettings
- java.lang.Object
-
- org.goplanit.gtfs.converter.GtfsConverterReaderSettingsImpl
-
- org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
-
- org.goplanit.gtfs.converter.service.GtfsServicesReaderSettings
-
- All Implemented Interfaces:
ConverterReaderSettings,GtfsConverterReaderSettings
public class GtfsServicesReaderSettings extends GtfsConverterReaderSettingsWithModeMapping implements ConverterReaderSettings
Configurable settings for the Gtfs to PLANit routed services reader- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_GROUP_IDENTICAL_GTFS_TRIPSby default group all identical Gtfs trips in a single PLANit trip (with a departure listing per original Gtfs trip)static booleanDEFAULT_INCLUDE_PARTIAL_GTFS_TRIPS_IF_STOPS_IN_TIME_PERIODby default, we include GTFS trips from the moment a stop falls within the eligible time period-
Fields inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
activatedGtfsModes, defaultGtfsMode2PrefinedModeTypeMap, routeTypeChoice
-
-
Constructor Summary
Constructors Constructor Description GtfsServicesReaderSettings(String countryName)Constructor with user defined source locale, the input source and other settings are reuqired to be populated by the user afterwardsGtfsServicesReaderSettings(String inputSource, String countryName, DayOfWeek dayOfWeekFilter, RouteTypeChoice routeTypeChoice)Constructor with user defined source localeGtfsServicesReaderSettings(String inputSource, String countryName, RouteTypeChoice routeTypeChoice)Constructor with user defined source locale, input location and route choice type infoGtfsServicesReaderSettings(URL inputSource, String countryName, DayOfWeek dayOfWeekFilter, RouteTypeChoice routeTypeChoice)Constructor with user defined source locale
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateLoggingForGtfsRouteByShortName(String gtfsShortName)Activate tracking of information for a given GTFS route by its short namevoidaddLogGtfsStopRoutes(String... gtfsStopIds)Indicate to log the routes that stop at the given GTFS stops (within selected time period(s).voidaddLogGtfsStopRoutes(List<String> gtfsStopIds)Indicate to log the routes that stop at the given GTFS stops (within selected time period(s).voidaddTimePeriodFilter(LocalTime startTimeWithinDay, LocalTime endTimeWithinDay)Add a time period filter.voidexcludeAllGtfsRoutesExceptByShortName(String... gtfsShortNames)Exclude all GTFS routes, except the ones provided here.voidexcludeAllGtfsRoutesExceptByShortName(List<String> gtfsShortNames)Exclude all GTFS routes, except the ones provided here.voidexcludeGtfsRoutesByShortName(String... gtfsShortNames)Exclude all GTFS routes, except the ones provided here.voidexcludeGtfsRoutesByShortName(List<String> gtfsShortNames)Exclude all GTFS routes, except the ones provided here.Set<String>getActivatedLoggingForGtfsRoutesByShortName()Unmodifiable set of tracked GTFS routes for logging purposesDayOfWeekgetDayOfWeek()The day of week to filter onstatic Function<ServiceNode,String>getServiceNodeToGtfsStopIdMapping()Provides access to how GTFS STOP IDS can be extracted from service nodes when service nodes are created using these settingsSet<Pair<LocalTime,LocalTime>>getTimePeriodFilters()Collect the currently configured time period filters.booleanhasTimePeriodFilters()Check whether any time periods are being filteredprotected voidinitialiseDefaultModeMappings()Conduct general initialisation for any instance of this classbooleanisActivatedLoggingForGtfsRouteByShortName(String gtfsShortName)Verify if a GTFS short name is already tracked for logging purposesbooleanisGroupIdenticalGtfsTrips()check value of flagbooleanisGtfsRouteIncludedByShortName(String gtfsShortName)Verify if a GTFS route is includedbooleanisIncludePartialGtfsTripsIfStopsInTimePeriod()get flag allowing users to include partial trips from the moment their stop times enter the eligible time period filter despite the trip departure time falling outside this windowbooleanisLogGtfsStopRoute(String gtfsStopId)Verify if GTFS stop id is marked for logging the stopping GTFS routes forvoidlogSettings()Log settings usedvoidreset()be able to reset all settings if neededvoidsetDayOfWeek(DayOfWeek dayOfWeek)Set the day of week to filter on (mandatory to be set)voidsetGroupIdenticalGtfsTrips(boolean groupIdenticalGtfsTrips)Set flag indicating to group GtfsTrips into single PLANit Trip schedule as long as they are identical except for departure time (which is listed separately)voidsetIncludePartialGtfsTripsIfStopsInTimePeriod(boolean includePartialGtfsTripsIfStopsInTimePeriod)set flag allowing users to include partial trips from the moment their stop times enter the eligible time period filter despite the trip departure time falling outside this window-
Methods inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
activateGtfsRouteTypeMode, deactivateAllModesExcept, deactivateGtfsMode, deactivateGtfsModes, findGtfsModesFor, getAcivatedGtfsModes, getAcivatedGtfsModes, getAcivatedPlanitPredefinedModes, getAcivatedPlanitPredefinedModes, getRouteTypeChoice, isGtfsModeActivated, setDefaultGtfs2PredefinedModeTypeMapping, setDefaultGtfs2PredefinedModeTypeMapping
-
Methods inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsImpl
getCountryName, getInputSource, setInputFile, setInputSource
-
-
-
-
Field Detail
-
DEFAULT_GROUP_IDENTICAL_GTFS_TRIPS
public static final boolean DEFAULT_GROUP_IDENTICAL_GTFS_TRIPS
by default group all identical Gtfs trips in a single PLANit trip (with a departure listing per original Gtfs trip)- See Also:
- Constant Field Values
-
DEFAULT_INCLUDE_PARTIAL_GTFS_TRIPS_IF_STOPS_IN_TIME_PERIOD
public static final boolean DEFAULT_INCLUDE_PARTIAL_GTFS_TRIPS_IF_STOPS_IN_TIME_PERIOD
by default, we include GTFS trips from the moment a stop falls within the eligible time period- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GtfsServicesReaderSettings
public GtfsServicesReaderSettings(String countryName)
Constructor with user defined source locale, the input source and other settings are reuqired to be populated by the user afterwards- Parameters:
countryName- to base source locale on
-
GtfsServicesReaderSettings
public GtfsServicesReaderSettings(String inputSource, String countryName, RouteTypeChoice routeTypeChoice)
Constructor with user defined source locale, input location and route choice type info- Parameters:
inputSource- to usecountryName- to base source locale onrouteTypeChoice- to apply
-
GtfsServicesReaderSettings
public GtfsServicesReaderSettings(String inputSource, String countryName, DayOfWeek dayOfWeekFilter, RouteTypeChoice routeTypeChoice)
Constructor with user defined source locale- Parameters:
inputSource- to usecountryName- to base source locale ondayOfWeekFilter- to userouteTypeChoice- to apply
-
GtfsServicesReaderSettings
public GtfsServicesReaderSettings(URL inputSource, String countryName, DayOfWeek dayOfWeekFilter, RouteTypeChoice routeTypeChoice)
Constructor with user defined source locale- Parameters:
inputSource- to usecountryName- to base source locale ondayOfWeekFilter- to userouteTypeChoice- to apply
-
-
Method Detail
-
initialiseDefaultModeMappings
protected void initialiseDefaultModeMappings()
Conduct general initialisation for any instance of this class- Overrides:
initialiseDefaultModeMappingsin classGtfsConverterReaderSettingsWithModeMapping
-
getServiceNodeToGtfsStopIdMapping
public static Function<ServiceNode,String> getServiceNodeToGtfsStopIdMapping()
Provides access to how GTFS STOP IDS can be extracted from service nodes when service nodes are created using these settings- Returns:
- function that maps service node to its GTFS_STOP_ID
-
excludeAllGtfsRoutesExceptByShortName
public void excludeAllGtfsRoutesExceptByShortName(String... gtfsShortNames)
Exclude all GTFS routes, except the ones provided here. Overrides any previous calls to this method, so only the provided listing is considered- Parameters:
gtfsShortNames- the only routes not to exclude
-
excludeAllGtfsRoutesExceptByShortName
public void excludeAllGtfsRoutesExceptByShortName(List<String> gtfsShortNames)
Exclude all GTFS routes, except the ones provided here. Overrides any previous calls to this method, so only the provided listing is considered- Parameters:
gtfsShortNames- the only routes not to exclude
-
isGtfsRouteIncludedByShortName
public boolean isGtfsRouteIncludedByShortName(String gtfsShortName)
Verify if a GTFS route is included- Parameters:
gtfsShortName- to verify- Returns:
- true when included, false otherwise
-
excludeGtfsRoutesByShortName
public void excludeGtfsRoutesByShortName(String... gtfsShortNames)
Exclude all GTFS routes, except the ones provided here. Overrides any previous calls to this method, so only the provided listing is considered- Parameters:
gtfsShortNames- the only routes not to exclude
-
excludeGtfsRoutesByShortName
public void excludeGtfsRoutesByShortName(List<String> gtfsShortNames)
Exclude all GTFS routes, except the ones provided here. Overrides any previous calls to this method, so only the provided listing is considered- Parameters:
gtfsShortNames- the only routes not to exclude
-
activateLoggingForGtfsRouteByShortName
public void activateLoggingForGtfsRouteByShortName(String gtfsShortName)
Activate tracking of information for a given GTFS route by its short name- Parameters:
gtfsShortName- to trac while parsing
-
isActivatedLoggingForGtfsRouteByShortName
public boolean isActivatedLoggingForGtfsRouteByShortName(String gtfsShortName)
Verify if a GTFS short name is already tracked for logging purposes- Parameters:
gtfsShortName- to verify- Returns:
- true, when tracked, false otherwise
-
getActivatedLoggingForGtfsRoutesByShortName
public Set<String> getActivatedLoggingForGtfsRoutesByShortName()
Unmodifiable set of tracked GTFS routes for logging purposes- Returns:
- the set
-
addTimePeriodFilter
public void addTimePeriodFilter(LocalTime startTimeWithinDay, LocalTime endTimeWithinDay)
Add a time period filter. When one or more filters are set, not full day of chosen day of week is parsed but only the trips that departure within the registered time periods- Parameters:
startTimeWithinDay- within day start time (inclusive)endTimeWithinDay- within day end time (inclusive)
-
getTimePeriodFilters
public Set<Pair<LocalTime,LocalTime>> getTimePeriodFilters()
Collect the currently configured time period filters. If no filters are applied, an empty set is provided, representing all times are included- Returns:
- map of eligible time periods by start, end time pairs
-
hasTimePeriodFilters
public boolean hasTimePeriodFilters()
Check whether any time periods are being filtered- Returns:
- true when filters are set, false otherwise
-
setDayOfWeek
public void setDayOfWeek(DayOfWeek dayOfWeek)
Set the day of week to filter on (mandatory to be set)- Parameters:
dayOfWeek- to choose
-
getDayOfWeek
public DayOfWeek getDayOfWeek()
The day of week to filter on- Returns:
- dayOfWeek chosen
-
logSettings
public void logSettings()
Log settings used- Specified by:
logSettingsin interfaceConverterReaderSettings- Specified by:
logSettingsin interfaceGtfsConverterReaderSettings- Overrides:
logSettingsin classGtfsConverterReaderSettingsWithModeMapping
-
isGroupIdenticalGtfsTrips
public boolean isGroupIdenticalGtfsTrips()
check value of flag- Returns:
- flag
-
setGroupIdenticalGtfsTrips
public void setGroupIdenticalGtfsTrips(boolean groupIdenticalGtfsTrips)
Set flag indicating to group GtfsTrips into single PLANit Trip schedule as long as they are identical except for departure time (which is listed separately)- Parameters:
groupIdenticalGtfsTrips- flag to set
-
isIncludePartialGtfsTripsIfStopsInTimePeriod
public boolean isIncludePartialGtfsTripsIfStopsInTimePeriod()
get flag allowing users to include partial trips from the moment their stop times enter the eligible time period filter despite the trip departure time falling outside this window- Returns:
- flag state
-
setIncludePartialGtfsTripsIfStopsInTimePeriod
public void setIncludePartialGtfsTripsIfStopsInTimePeriod(boolean includePartialGtfsTripsIfStopsInTimePeriod)
set flag allowing users to include partial trips from the moment their stop times enter the eligible time period filter despite the trip departure time falling outside this window- Parameters:
includePartialGtfsTripsIfStopsInTimePeriod- flag to set
-
addLogGtfsStopRoutes
public void addLogGtfsStopRoutes(String... gtfsStopIds)
Indicate to log the routes that stop at the given GTFS stops (within selected time period(s). Can be useful for debugging purposes.- Parameters:
gtfsStopIds- GTFS stop id to provide stopping GTFS routes for
-
addLogGtfsStopRoutes
public void addLogGtfsStopRoutes(List<String> gtfsStopIds)
Indicate to log the routes that stop at the given GTFS stops (within selected time period(s). Can be useful for debugging purposes.- Parameters:
gtfsStopIds- GTFS stop id to provide stopping GTFS routes for
-
isLogGtfsStopRoute
public boolean isLogGtfsStopRoute(String gtfsStopId)
Verify if GTFS stop id is marked for logging the stopping GTFS routes for- Parameters:
gtfsStopId- GTFS stop id to verify- Returns:
- true when present, false otherwise
-
reset
public void reset()
be able to reset all settings if needed- Specified by:
resetin interfaceConverterReaderSettings- Overrides:
resetin classGtfsConverterReaderSettingsWithModeMapping
-
-