Exemple #1
0
        public static IAbstractFactory <YaBo, YaJia> ZhouheiyaFactory(string type)
        {
            if (type == "南昌")
            {
                return(ConcretFactory.NewFactory(
                           new OpNewFactory <YaBo, NanChangYaBo>(),
                           new OpNewFactory <YaJia, NanChangYaJia>()));
            }
            else if (type == "上海")
            {
                return(ConcretFactory.NewFactory(
                           new OpNewFactory <YaBo, ShangHaiYaBo>(),
                           new OpNewFactory <YaJia, ShangHaiYaJia>()));
            }

            return(null);
        }
Exemple #2
0
        public static IAbstractFactory <Processor, Ram> ComputerFactory(string type)
        {
            if (type == "Intel")
            {
                return(ConcretFactory.NewFactory(
                           new OpNewFactory <Processor, PentiumProcessor>(),
                           new OpNewFactory <Ram, DDR2Ram>()));
            }
            else if (type == "AMD")
            {
                return(ConcretFactory.NewFactory(
                           new OpNewFactory <Processor, AthlonProcessor>(),
                           new OpNewFactory <Ram, DDRRam>()));
            }

            return(null);
        }