Class ArrivalTimeCalculator

java.lang.Object
slash.navigation.common.ArrivalTimeCalculator

public class ArrivalTimeCalculator extends Object
Calculates each position's arrival time of day from a single departure time and the routing durations already calculated as cumulative milliseconds from the start of the route.
Author:
Christian Pesch
  • Constructor Details

    • ArrivalTimeCalculator

      public ArrivalTimeCalculator()
  • Method Details

    • calculateArrivalTimes

      public static CompactCalendar[] calculateArrivalTimes(CompactCalendar departure, long[] cumulativeMillisFromStart)
      Calculates the arrival time of day for each position.

      arrival[i] = departure + cumulativeMillisFromStart[i]. cumulativeMillisFromStart[0] is expected to be 0, so arrival[0] equals departure exactly. Date roll-over across midnight is handled since the result is built with CompactCalendar.fromMillis(long).

      Parameters:
      departure - the departure time; must not be null
      cumulativeMillisFromStart - the cumulative milliseconds from the start of the route to each position
      Returns:
      the arrival time of day for each position
      Throws:
      IllegalArgumentException - if departure is null