private static IList <StationLocation> RedwardPath(StationLocation fromLocation, StationLocation toLocation) { var redwardLocation = fromLocation.RedwardStationLocation(); if (redwardLocation == null) { return(null); } if (redwardLocation == toLocation) { return new List <StationLocation> { toLocation } } ; var oppositeDeckPath = OppositeDeckPath(redwardLocation.Value, toLocation); if (oppositeDeckPath != null) { return new List <StationLocation> { redwardLocation.Value, oppositeDeckPath.Single() } } ; var redwardPath = RedwardPath(redwardLocation.Value, toLocation); return(redwardPath == null ? null : new[] { redwardLocation.Value }.Concat(RedwardPath(redwardLocation.Value, toLocation)).ToList()); }
protected override StationLocation?GetStationToSpreadTo(StationLocation stationLocation) { return(stationLocation.RedwardStationLocation()); }