Наследование: BaseModel
Пример #1
0
 public static void AddHubType(HubType type)
 {
     Types.Add(type);
 }
Пример #2
0
 //returns all hubtypes
 //returns a hub type of a specific type
 public static HubType GetHubType(HubType.TypeOfHub type)
 {
     return Types.Find(t => t.Type == type);
 }
Пример #3
0
 public Hub(Airline airline, HubType type)
 {
     Airline = airline;
     Type = type;
 }
        public static double GetHubPrice(Airport airport, HubType type)
        {
            double price = type.Price;

            price = price + 25000*((int) airport.Profile.Size);
            return Convert.ToInt64(GeneralHelpers.GetInflationPrice(price));
        }
Пример #5
0
        public List<Hub> GetHubs(HubType.TypeOfHub type)
        {
            List<Hub> hubs;
            lock (_hubs) hubs = new List<Hub>(_hubs);

            return hubs.FindAll(h => h.Type.Type == type);
        }
        //returns if an airline can create a hub at an airport
        public static bool CanCreateHub(Airline airline, Airport airport, HubType type)
        {
            Terminal.TerminalType terminaltype = airline.AirlineRouteFocus == Route.RouteType.Cargo ? Terminal.TerminalType.Cargo : Terminal.TerminalType.Passenger;

            bool airlineHub = airport.GetHubs().Exists(h => h.Airline == airline);

            int airlineValue = (int) airline.GetAirlineValue() + 1;

            int totalAirlineHubs = airline.GetHubs().Count; // 'Airports.GetAllActiveAirports().Sum(a => a.Hubs.Count(h => h.Airline == airline));
            double airlineGatesPercent = Convert.ToDouble(airport.Terminals.GetNumberOfGates(airline))/Convert.ToDouble(airport.Terminals.GetNumberOfGates(terminaltype))*100;

            switch (type.Type)
            {
                case HubType.TypeOfHub.FocusCity:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type);
                case HubType.TypeOfHub.RegionalHub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) &&
                           (airport.Profile.Size == GeneralHelpers.Size.Large || airport.Profile.Size == GeneralHelpers.Size.Medium) && airport.GetHubs().Count < 7;
                case HubType.TypeOfHub.FortressHub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airport.Profile.Size > GeneralHelpers.Size.Medium) && airlineGatesPercent > 70 &&
                           (totalAirlineHubs < airlineValue);
                case HubType.TypeOfHub.Hub:
                    return !airlineHub && airline.Money > AirportHelpers.GetHubPrice(airport, type) && (airlineGatesPercent > 20) && (totalAirlineHubs < airlineValue) &&
                           (airport.GetHubs(HubType.TypeOfHub.Hub).Count < (int) airport.Profile.Size);
            }

            return false;
        }