Ejemplo n.º 1
0
 public CargoTaxi(TaxiTypes taxiType, int speed, int price, int consumption, int fuel)
 {
     if (speed > 0)
     {
         Speed = speed;
     }
     if (price > 0)
     {
         Price = price;
     }
     if (consumption > 0)
     {
         Consumption = consumption;
     }
     if (fuel > 0)
     {
         Fuel = fuel;
     }
     TaxiType = taxiType;
     if (fuel == 0)
     {
         IsReadyToWork = false;
     }
     else
     {
         IsReadyToWork = true;
     }
 }
Ejemplo n.º 2
0
        public void CreateTaxi(TaxiTypes taxiType, int speed, int price, int consumption, int fuel = 0)
        {
            _taxiFactory = _factoryCreator.GetConcreteFactory(taxiType);
            ITaxi taxi = _taxiFactory.CreateTaxi(taxiType, speed, price, consumption, fuel);

            _taxis.Add(taxi);
        }
 public TaxiFactory GetConcreteFactory(TaxiTypes taxiTypes)
 {
     if (taxiTypes == TaxiTypes.Cargo | taxiTypes == TaxiTypes.Pass | taxiTypes == TaxiTypes.Ricksha)
     {
         return(_factories[taxiTypes]);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
 public RickshaTaxi(TaxiTypes taxiType, int speed, int price, int consumption)
 {
     if (speed > 0)
     {
         Speed = speed;
     }
     if (price > 0)
     {
         Price = price;
     }
     if (consumption > 0)
     {
         Consumption = consumption;
     }
     TaxiType      = taxiType;
     IsReadyToWork = true;
 }
 public override ITaxi CreateTaxi(TaxiTypes taxiType, int speed, int price, int consumption, int fuel)
 {
     return(new PassTaxi(taxiType, speed, price, consumption, fuel));
 }
 public abstract ITaxi CreateTaxi(TaxiTypes taxiType, int speed, int price, int consumption, int fuel = 0);