Beispiel #1
0
        static void Main(string[] args)
        {
            //color
            RedColorMachine   red        = new RedColorMachine();
            GreenColorMachine green      = new GreenColorMachine();
            BlueColorMachine  blue       = new BlueColorMachine();
            FinalColorMachine finalColor = new FinalColorMachine();

            //text
            UppercaseTextMachine uppercase = new UppercaseTextMachine();
            SpacingTextMachine   spacing   = new SpacingTextMachine();
            FinalTextMachine     finalText = new FinalTextMachine();

            //frame
            FinalCheckFrameMachine finalFrame = new FinalCheckFrameMachine();

            //presentation
            PresentationMachine presentation = new PresentationMachine();

            Console.WriteLine("--- Simple Production Line ---");
            ProductionLine simple = new ProductionLine();
            //Machine special for simple line
            SimpleCircleFrameMachine simpleCircle = new SimpleCircleFrameMachine();
            SimpleSquareFrameMachine simpleSquare = new SimpleSquareFrameMachine();

            simple.SetNextMachine(red).SetNextMachine(finalText).SetNextMachine(simpleCircle).SetNextMachine(simpleSquare).SetNextMachine(finalFrame).SetNextMachine(presentation);

            ProducePictures(orders, simple);

            Console.WriteLine();

            Console.WriteLine("--- Complex Production Line ---");
            ProductionLine complex = new ProductionLine();
            //Machine special for complex line
            ComplexCircleFrameMachine   complexCircle   = new ComplexCircleFrameMachine();
            ComplexSquareFrameMachine   complexSquare   = new ComplexSquareFrameMachine();
            ComplexTriangleFrameMachine complexTriangle = new ComplexTriangleFrameMachine();

            complex.SetNextMachine(red).SetNextMachine(green).SetNextMachine(blue).SetNextMachine(finalColor).
            SetNextMachine(spacing).SetNextMachine(uppercase).SetNextMachine(finalText).
            SetNextMachine(complexCircle).SetNextMachine(complexSquare).SetNextMachine(complexTriangle).SetNextMachine(finalFrame).
            SetNextMachine(presentation);

            ProducePictures(orders, complex);
        }