コード例 #1
0
        public void Run(IRunner runner)
        {
            runner.InstantiateObject(typeof(Sorter), null);

            var taskIds = new List <long>();

            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list1 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list2 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list3 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list4 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list5 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list6 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list7 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list8 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list9 }));
            taskIds.Add(runner.RunFunction(typeof(Sorter), "BubbleSort", new object[] { list10 }));

            while (!runner.TasksCompleted())
            {
                Thread.Sleep(100);
            }

            for (var i = 0; i < taskIds.Count; i++)
            {
                var sortedList = (List <int>)runner.GetResult(taskIds[i]);
                Console.WriteLine($"List {i + 1}:");
                foreach (var item in sortedList)
                {
                    Console.Write($"{item} ");
                }

                Console.WriteLine();
            }
        }