Class RelativeLegTimingUtils


  • public class RelativeLegTimingUtils
    extends Object
    Utilities for RelativeLegTimings
    Author:
    markr
    • Constructor Detail

      • RelativeLegTimingUtils

        public RelativeLegTimingUtils()
    • Method Detail

      • isLegTimingMappedToServiceNetwork

        public static boolean isLegTimingMappedToServiceNetwork​(RelativeLegTiming relativeLegTiming,
                                                                ServiceLegSegments legSegments,
                                                                ServiceNodes serviceNodes)
        Verify if leg timing is mapped to service network, i.e., its has service nodes that also exist on the service network service nodes AND it has service leg segments that also exist on the service network leg segments
        Parameters:
        relativeLegTiming - to verify
        legSegments - of the service network
        serviceNodes - of the service network
        Returns:
        true when mapped and references exist, false otherwise
      • findNextTimingLegMappedToServiceNetwork

        public static int findNextTimingLegMappedToServiceNetwork​(int offsetLegIndex,
                                                                  RoutedTripSchedule routedTripSchedule,
                                                                  RoutedServicesLayer routedServiceLayer)
        find the first valid relative timing leg using a given offset index. Valid here means mapped to a service network AND the reference to the service network used still exists in that service network (having a reference itself does not suffice)
        Parameters:
        offsetLegIndex - offset, use this leg as starting point for search (inclusive), must be zero or higher
        routedTripSchedule - containing the relative leg timings
        routedServiceLayer - to source service network from
        Returns:
        found first next available timing index for which the service network contains the referenced leg(segment), if no valid ones can be found the return value exceeds the size of the rel timings
      • findLegTimingsNotMappedToServiceNetwork

        public static List<Integer> findLegTimingsNotMappedToServiceNetwork​(RoutedTripSchedule routedTripSchedule,
                                                                            RoutedServicesLayer routedServicesLayer)
        find list of ordered indices of leg timings that are not (fully) mapped to the reference service network, or they are mapped but the references do not exist in the related service network
        Parameters:
        routedTripSchedule - to collect relative leg timings from
        routedServicesLayer - to compare against, i.e., source the service network from
        Returns:
        list of ascending indices of invalid relative leg timings