GetDestinationsPassengers() public method

public GetDestinationsPassengers ( ) : List
return List
コード例 #1
0
 public static void CreateDestinationPassengers(Airport airport)
 {
     List<Airport> airports =
         Airports.GetAirports(
             a =>
             a != airport && a.Profile.Town != airport.Profile.Town
             && MathHelpers.GetDistance(
                 a.Profile.Coordinates.ConvertToGeoCoordinate(),
                 airport.Profile.Coordinates.ConvertToGeoCoordinate()) > 50);
     //Parallel.ForEach(airports, dAirport =>
     foreach (Airport dAirport in airports)
     {
         CreateDestinationPassengers(airport, dAirport);
     } //);
     if (airport.GetDestinationsPassengers().Sum(d => d.Rate) == 0)
     {
         List<Airport> subAirports =
             airports.FindAll(a => a.Profile.Country == airport.Profile.Country).DefaultIfEmpty().ToList();
         subAirports.RemoveAll(a => a == null);
         if (subAirports.Any())
         {
             CreateDestinationPassengers(airport, subAirports);
         }
         else
         {
             subAirports =
                 airports.FindAll(a => a.Profile.Country.Region == airport.Profile.Country.Region).ToList();
             CreateDestinationPassengers(airport, subAirports);
         }
     }
 }
コード例 #2
0
 //changes the demand for an airport with a factor
 public static void ChangePaxDemand(Airport airport, double factor)
 {
     double value = (100 + factor)/100;
     //factor 0.5 - 2;
     foreach (DestinationDemand destPax in airport.GetDestinationsPassengers())
     {
         if (destPax.Rate > 0)
         {
             ushort oRate = destPax.Rate;
             if ((oRate*value).Equals(destPax.Rate))
             {
                 destPax.Rate =
                     Convert.ToUInt16(destPax.Rate + Convert.ToUInt16(Rnd.Next(0, Math.Max(1, (int) factor))));
             }
             else
             {
                 destPax.Rate = (ushort) (destPax.Rate*value);
             }
         }
         else
         {
             destPax.Rate = (ushort) Rnd.Next(1, Math.Max(1, (int) factor));
         }
     }
 }
コード例 #3
0
 public static void ReallocateAirport(Airport airportOld, Airport airportNew)
 {
     if (airportNew.GetMajorDestinations().Count == 0)
     {
         foreach (DestinationDemand paxDemand in airportOld.GetDestinationsPassengers())
         {
             airportNew.AddDestinationPassengersRate(paxDemand);
         }
     }
 }