Class GtfsServicesReaderSettings

    • 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 use
        countryName - to base source locale on
        routeTypeChoice - to apply
      • GtfsServicesReaderSettings

        public GtfsServicesReaderSettings​(String inputSource,
                                          String countryName,
                                          DayOfWeek dayOfWeekFilter,
                                          RouteTypeChoice routeTypeChoice)
        Constructor with user defined source locale
        Parameters:
        inputSource - to use
        countryName - to base source locale on
        dayOfWeekFilter - to use
        routeTypeChoice - to apply
      • GtfsServicesReaderSettings

        public GtfsServicesReaderSettings​(URL inputSource,
                                          String countryName,
                                          DayOfWeek dayOfWeekFilter,
                                          RouteTypeChoice routeTypeChoice)
        Constructor with user defined source locale
        Parameters:
        inputSource - to use
        countryName - to base source locale on
        dayOfWeekFilter - to use
        routeTypeChoice - to apply
    • Method Detail

      • 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
      • 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