Esempio n. 1
0
        static void Main(string[] args)
        {
            //可根据想要使用的算法进行调用
            Composition com = new Composition(new SimpleCompositor());

            com.Repair();
            Console.WriteLine("——————————");
            //算法替换
            com.ChangeCompositor(new TxtCompositor());
            com.Repair();
            Console.WriteLine("——————————");
            //算法替换
            com.ChangeCompositor(new ArrayCompositor());
            com.Repair();

            Console.ReadLine();
        }
Esempio n. 2
0
        public static void ExecuteScript()
        {
            Console.WriteLine(new string('_', 100));
            Console.WriteLine("STRATEGY\n\n");

            // Set compositor
            Composition composition = new Composition(new SimpleCompositor());

            // Create components List
            CreateComponentsList(composition);

            composition.Repair();
            composition.Draw();

            Console.WriteLine("\n\n");

            composition.SetCompositor(new ArrayCompositor());
            composition.Repair();
            composition.Draw();

            Console.WriteLine("\n\n");
        }