Exemplo n.º 1
0
 public Battery(int nCells, int capCells, bool bycycles)
 {
     for (int i = 0; i < nCells; i++)
     {
         elems.Add(new Cell(capCells));
     }
     if (bycycles)
     {
         myStrat = new StratRoundRobin();
     }
     else
     {
         myStrat = new StratMinMax();
     }
 }
Exemplo n.º 2
0
        public ChargeContext(string type)
        {
            switch (type)
            {
            case "正常收费":
                _chargeStrategy = new Normal();
                break;

            case "满300反100":
                _chargeStrategy = new ManJian(300, 100);
                break;

            case "打8折":
                _chargeStrategy = new Discount(0.8);
                break;
            }
        }
 public ChargeStrategyFactory(ITradeUnionChargeStrategy tradeUnion, INoneChargeStrategy none, IEmployeeRepository employeeRepository)
 {
     _tradeUnion         = tradeUnion;
     _none               = none;
     _employeeRepository = employeeRepository;
 }