Exemple #1
0
        static void Main(string[] args)
        {
            var h1 = new ConcreteHandler1();
            var h2 = new ConcreteHandler2();
            var h3 = new ConcreteHandler3();


            h1.SetSucessor(h2);
            h2.SetSucessor(h3);

            int[] requests = { 200, 5, 24, 22, 18, 3, 27, 20 };
            foreach (var request in requests)
            {
                h1.HandleRequest(request);
            }
        }
Exemple #2
0
        //maneira de passar uma requisicao por meio de uma cadeia de objetos
        static void Main(string[] args)
        {
            Handler H1 = new ConcreteHandler1();
            Handler H2 = new ConcreteHandler2();
            Handler H3 = new ConcreteHandler3();

            //cadeia de objetos
            H1.SetSucessor(H2);
            H2.SetSucessor(H3);

            int[] requests = { 2, 5, 24, 22, 18, 3, 27, 20 };

            foreach (int request in requests)
            {
                H1.HandleRequest(request);
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Handler h1 = new ConcreteHandler1();
            Handler h2 = new ConcreteHandler2();
            Handler h3 = new ConcreteHandler2();

            h1.SetSucessor(h2);
            h2.SetSucessor(h3);

            int[] requests = { 2, 5, 24, 22, 18, 3, 27, 20 };

            foreach (int request in requests)
            {
                h1.HandlerRequest(request);
            }
            Console.ReadKey();
        }