Пример #1
0
        public void Run()
        {
            char anotherDs;

            do
            {
                DataStructureTypes selectedDataStructure = SelectDataStructure();

                IDataStructure <TDataType> dataStructureInstance =
                    dataStructureFactory.GetDataStructure(selectedDataStructure);

                char anotherOperation;
                do
                {
                    object selectedOperation = SelectOperation(selectedDataStructure);

                    IOperate dsOperator = operatorFactory.GetOperator(selectedDataStructure, dataStructureInstance, selectedOperation);

                    dsOperator.Operate();

                    Console.WriteLine("Do you want to select another Operation? Y/N");
                    anotherOperation = Convert.ToChar(Console.ReadLine() ?? throw new InvalidOperationException());
                } while (anotherOperation == 'y' || anotherOperation == 'Y');

                Console.WriteLine("Do you want to select another Data Structure? Y/N");
                anotherDs = Convert.ToChar(Console.ReadLine() ?? throw new InvalidOperationException());
            } while (anotherDs == 'y' || anotherDs == 'Y');
        }