public TravellingTimeMinimizer Add(Journey <TravellingTimeMinimizer> journey, StopId currentLocation, ulong currentTime, TripId currentTripId, bool currentIsSpecial) { var totalTimeWalking = _totalTimeWalking; var totalTimeInVehicle = _totalTimeInVehicle; var smallestTransfer = _smallestTransfer; var journeyTime = (uint)(journey.ArrivalTime() - journey.DepartureTime()); if (journey.SpecialConnection && journey.Connection.Equals(OTHERMODE)) { totalTimeWalking += journeyTime; } else if (journey.SpecialConnection && journey.Connection.Equals(OTHERMODE)) { smallestTransfer = Math.Min(smallestTransfer, journeyTime); } else if (!journey.SpecialConnection) { // We simply are travelling in a vehicle totalTimeInVehicle += journeyTime; } return(new TravellingTimeMinimizer(totalTimeWalking, totalTimeInVehicle, smallestTransfer)); }