Last active
October 27, 2018 18:15
-
-
Save RikkiGibson/f0771f6cecb9b769493f9c3f28f0c4c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ValidateGoogleSchedule(List<GoogleRouteSchedule> routeSchedules) | |
{ | |
foreach (GoogleRouteSchedule routeSchedule in routeSchedules) | |
{ | |
foreach (GoogleDaySchedule routeDaySchedule in routeSchedule.Days) | |
{ | |
var stopSchedules = routeDaySchedule.StopSchedules; | |
var pairs = stopSchedules.Take(stopSchedules.Count - 1).Zip(stopSchedules.Skip(1), (fst, snd) => (fst, snd)); | |
foreach (var (fst, snd) in pairs) | |
{ | |
Debug.Assert(fst.Times.Count == snd.Times.Count); | |
for (var i = 0; i < fst.Times.Count; i++) | |
{ | |
if (fst.Times[0] > snd.Times[0]) | |
{ | |
Console.WriteLine($"Time travel violation for {routeSchedule.RouteNo}. {fst.Name} at {fst.Times[i]} occurs after and {snd.Name} at {snd.Times[i]}"); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment