/// <summary> /// Returns whether the <paramref name="trip"/> CanBeScheduled for the /// <paramref name="patron"/>, taking into consideration any <paramref name="deltas"/> /// incurred by boarding mid-line. /// </summary> /// <param name="trip"></param> /// <param name="patron"></param> /// <param name="deltas"></param> /// <returns></returns> public static bool CanBeScheduled(this Trip trip, Patron patron, GetStopIntervalsMinutesDelegate deltas) { // Deal with these couple of obvious criteria first. if (trip == null || trip.Direction != patron.Direction) return false; var totalDeltaMinutes = deltas(patron).Sum(); /* Now we can deal with the next obvious condition. Do not normalize the Patron time * after all. Not only is this acceptable as-is, I truly don't believe there is a way * for us to know otherwise; unless we wanted to incorporate actual DateTime dates * into the mix. */ return trip.DepartureTimeMinutes + totalDeltaMinutes >= patron.DepartureTimeMinutes; }
/// <summary> /// Returns whether the <paramref name="trip"/> CannotBeScheduled for the /// <paramref name="patron"/>, taking into consideration any <paramref name="deltas"/> /// incurred by boarding mid-line. /// </summary> /// <param name="trip"></param> /// <param name="patron"></param> /// <param name="deltas"></param> /// <returns></returns> public static bool CannotBeScheduled(this Trip trip, Patron patron, GetStopIntervalsMinutesDelegate deltas) { return !trip.CanBeScheduled(patron, deltas); }