Created
June 25, 2020 14:26
-
-
Save linusnorton/cce2df9db1b223c46ddccb0cbea477e2 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
function isReachable(results: Results, c: Connection): boolean { | |
const interchangeTime = results.bestConnections[c.origin] ? interchangeTimeAt(c.origin) : 0; | |
const reachableWithInterchange = results.earliestArrival[c.origin] | |
&& results.earliestArrival[c.origin] + interchangeTime <= c.departureTime; | |
results.tripsReachable[c.trip.tripId] = reachableWithInterchange || results.tripsReachable[c.trip.tripId]; | |
return results.tripsReachable[c.trip.tripId]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment