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); }
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); }
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); }
public ElectricEnergySource(float i_CurrentEnergyAmount, EnergyFillingInfo i_EnergyFillingInfo) : base(i_CurrentEnergyAmount, i_EnergyFillingInfo) { r_ElectricityFillingInfo = Helpers.StrongArgumentNeededTypeCheckAndCast <ElectricityFillingInfo>(i_EnergyFillingInfo); }