Exemplo n.º 1
0
        /// <summary>
        /// Returns a list of Timespans and the associated number of vehicles in that time span
        /// </summary>
        /// <param name="h"></param>
        /// <param name="vehicleType"></param>
        /// <param name="aux"></param>
        /// <returns></returns>
        private static Dictionary <TashaTimeSpan, int> FindVehicleAvailabilitesHelper(ITashaHousehold h, IVehicleType vehicleType, bool aux)
        {
            Dictionary <TashaTimeSpan, int> availabilities = new Dictionary <TashaTimeSpan, int>();
            List <ITripChain> allTripChains;

            if (aux)
            {
                allTripChains = h.AllTripChainsWithAuxThatUseVehicle(vehicleType);
            }
            else
            {
                allTripChains = h.AllTripChainsThatUseVehicle(vehicleType);
            }
            int vehiclesAvailable = 0;
            var vehicles          = h.Vehicles;

            for (int i = 0; i < vehicles.Length; i++)
            {
                if (vehicles[i].VehicleType == vehicleType)
                {
                    vehiclesAvailable++;
                }
            }
            return(FindVehicleAvailabilites(allTripChains, vehiclesAvailable));
        }