Ejemplo n.º 1
0
        public EnergySource(float i_CurrentEnergyAmount, EnergyFillingInfo i_EnergyFillingInfo)
        {
            CurrentEnergyAmount = i_CurrentEnergyAmount;
            r_EnergyFillingInfo = i_EnergyFillingInfo;

            // check that started energy amount is in range by the energy filling info
            string valueName = "Current energy amount";

            Helpers.IsPossibleAddingValueInRangeCheck(0, CurrentEnergyAmount, k_MinimumEnergyFillingValue,
                                                      r_EnergyFillingInfo.MaximumAmount, valueName);
        }
Ejemplo n.º 2
0
        private static EnergyFillingInfo getElectricityEnergyFillingInfoByVehicleType(eVehicleType i_VehicleType)
        {
            EnergyFillingInfo electricityFillingInfo = null;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                electricityFillingInfo = new ElectricityFillingInfo(Constants.k_CarBatteryCapacity);
                break;

            case eVehicleType.Motorcycle:
                electricityFillingInfo = new ElectricityFillingInfo(Constants.k_MotorcycleBatteryCapacity);
                break;

            case eVehicleType.Truck:
                throw new NotSupportedException("Truck with electricity engine is not supported");

            default:
                throw new ArgumentOutOfRangeException("i_VehicleType");
            }
            return(electricityFillingInfo);
        }
Ejemplo n.º 3
0
        private static EnergyFillingInfo getFuelEnergyFillingInfoByVehicleType(eVehicleType i_VehicleType)
        {
            EnergyFillingInfo fuelFillingInfo = null;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                fuelFillingInfo = new FuelFillingInfo(Constants.k_CarFuelType, Constants.k_CarFuelTankVolume);
                break;

            case eVehicleType.Motorcycle:
                fuelFillingInfo = new FuelFillingInfo(Constants.k_MotorcycleFuelType,
                                                      Constants.k_MotorcycleFuelTankVolume);
                break;

            case eVehicleType.Truck:
                fuelFillingInfo = new FuelFillingInfo(Constants.k_TruckFuelType, Constants.k_TruckFuelTankVolume);
                break;

            default:
                throw new ArgumentOutOfRangeException("i_VehicleType");
            }
            return(fuelFillingInfo);
        }
Ejemplo n.º 4
0
 public ElectricEnergySource(float i_CurrentEnergyAmount, EnergyFillingInfo i_EnergyFillingInfo)
     : base(i_CurrentEnergyAmount, i_EnergyFillingInfo)
 {
     r_ElectricityFillingInfo =
         Helpers.StrongArgumentNeededTypeCheckAndCast <ElectricityFillingInfo>(i_EnergyFillingInfo);
 }