Class RelativeLegTimingUtils
- java.lang.Object
-
- org.goplanit.utils.service.routed.RelativeLegTimingUtils
-
public class RelativeLegTimingUtils extends Object
Utilities for RelativeLegTimings- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description RelativeLegTimingUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 networkstatic int
findNextTimingLegMappedToServiceNetwork(int offsetLegIndex, RoutedTripSchedule routedTripSchedule, RoutedServicesLayer routedServiceLayer)
find the first valid relative timing leg using a given offset index.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
-
-
-
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 verifylegSegments
- of the service networkserviceNodes
- 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 higherroutedTripSchedule
- containing the relative leg timingsroutedServiceLayer
- 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 fromroutedServicesLayer
- to compare against, i.e., source the service network from- Returns:
- list of ascending indices of invalid relative leg timings
-
-