Esempio n. 1
0
        public ICar Produce(List <string> cmdArgs, ITyre tyre)
        {
            var  hp         = int.Parse(cmdArgs[3]);
            var  fuelAmount = double.Parse(cmdArgs[4]);
            ICar car        = new Car(hp, fuelAmount, tyre);

            return(car);
        }
Esempio n. 2
0
        public void RegisterDriver(List <string> commandArgs)
        {
            ITyre   tyre   = tyreFactory.Produce(commandArgs);
            ICar    car    = carFactory.Produce(commandArgs, tyre);
            IDriver driver = driverFactory.Produce(commandArgs, car, this.lengthOfLap);

            if (tyre == null || car == null || driver == null)
            {
                throw new ArgumentException("Invalid arguments for registering driver");
            }
            this.drivers.Add(driver);
        }
Esempio n. 3
0
        public ITyre Produce(List <string> cmdArgs)
        {
            var   type = cmdArgs[5];
            ITyre tyre = null;

            if (type == "Ultrasoft")
            {
                var hardness = double.Parse(cmdArgs[6]);
                var grip     = double.Parse(cmdArgs[7]);
                tyre = new UltrasoftTyre(hardness, grip);
            }
            else if (type == "Hard")
            {
                var hardness = double.Parse(cmdArgs[6]);
                tyre = new HardTyre(hardness);
            }
            return(tyre);
        }
Esempio n. 4
0
        private void ChangeTyres(List <string> commandArgs, IDriver driver)
        {
            var   type    = commandArgs[3];
            ITyre newTyre = null;

            if (type == "Ultrasoft")
            {
                var hardness = double.Parse(commandArgs[4]);
                var grip     = double.Parse(commandArgs[5]);
                newTyre = new UltrasoftTyre(hardness, grip);
            }
            else if (type == "Hard")
            {
                var hardness = double.Parse(commandArgs[4]);
                newTyre = new HardTyre(hardness);
            }
            if (driver != null)
            {
                driver.Car.Tyre = newTyre;
            }
        }
Esempio n. 5
0
 public Motocycle(MotocycleBuilder builder)
 {
     this._brake  = builder.GetBrake();
     this._tyre   = builder.GetTyre();
     this._engine = builder.GetEngine();
 }
 public Promotion(IDealer dealer, string category)
 {
     tyre = dealer.GetTyre(category);
     car  = dealer.GetCar(category);
 }
Esempio n. 7
0
    public ICar CreteCar(int hp, double fuelAmount, ITyre tyre)
    {
        ICar car = new Car(hp, fuelAmount, tyre);

        return(car);
    }
 public MotocycleBuilder SetTyre(ITyre value)
 {
     this._tyre = value;
     return(this);
 }
Esempio n. 9
0
 public Car(int hp, double fuelAmount, ITyre tyre)
 {
     this.Hp         = hp;
     this.FuelAmount = fuelAmount;
     this.Tyre       = tyre;
 }
Esempio n. 10
0
 public void ChangeTyre(ITyre tyre)
 {
     this.Tyre = tyre;
 }
Esempio n. 11
0
    public void BoxChangeTyres(ITyre tyre)
    {
        this.Car.ChangeTyre(tyre);

        this.TotalTime += BOX_INCREASE_TIME;
    }