Exemplo n.º 1
0
        private static async Task Start(IList <string> files)
        {
            Console.WriteLine(@"=============================================================
Press the number of the method you want to run and press ENTER

(1) RunFuzzyMatchc Task Composition  (TODO 1)
(2) RunFuzzyMatch Task LINQ  (TODO 2)
(3) RunFuzzyMatchc Pipeline  (TODO 3)
(4) RunFuzzyMatch Process Tasks as complete (TODO 4)
(5) RunFuzzyMatchDataFlow  (TODO 5 - 6)
(6) RunFuzzyMatch Agent C# (TODO 7 C#)
(7) RunFuzzyMatch Agent F# (TODO 7 F#)
(8) Agent Aggregate (TODO 8 C#)
=============================================================
");

            var choice      = Console.ReadLine();
            var indexChoice = int.Parse(choice);
            var watch       = Stopwatch.StartNew();

            switch (indexChoice)
            {
            case 1:
                // TODO 1
                await ParallelFuzzyMatch.RunFuzzyMatchTaskComposition(WordsToSearch, files);

                break;

            case 2:
                // TODO 2
                await ParallelFuzzyMatch.RunFuzzyMatchTaskLINQ(WordsToSearch, files);

                break;

            case 3:
                // TODO 3
#if FSHARP
                ParallelFuzzyMatch.RunFuzzyMatchPipelineFSharp(WordsToSearch, files);
#else
                ParallelFuzzyMatch.RunFuzzyMatchPipelineCSharp(WordsToSearch, files);
#endif

                break;

            case 4:
                // TODO 4
                await ParallelFuzzyMatch.RunFuzzyMatchTaskProcessAsCompleteAbstracted(WordsToSearch, files);

                break;

            case 5:
                // TODO 5 - 6
                await ParallelFuzzyMatch.RunFuzzyMatchDataFlow(WordsToSearch, files);

                break;

            case 6:
                // TODO 7 (C#)
                await ParallelFuzzyMatch.RunFuzzyMatchAgentCSharp(WordsToSearch, files);

                break;

            case 7:
                // TODO 7 (F#)
                await ParallelFuzzyMatch.RunFuzzyMatchAgentFSharp(WordsToSearch, files);

                break;

            case 8:
                // TODO 8 (C#)
                AgentAggregate.Run();

                break;

            default:
                throw new Exception("Selection not supported");
            }
            watch.Stop();

            Console.WriteLine($"<< DONE in {watch.Elapsed.ToString()} >>");
        }
Exemplo n.º 2
0
        private static async Task Start(IList <string> files)
        {
            Console.WriteLine(@"=============================================================
Press the number of the method you want to run and press ENTER

(1) RunFuzzyMatchTaskComposition  (TODO 1)
(2) RunFuzzyMatchPLINQ  (TODO 2)
(3) RunFuzzyMatchPipeline  (TODO 3)
(4) RunFuzzyMatchTaskProcessAsCompleteAbstracted  (TODO 4)
(5) RunFuzzyMatchDataFlow  (TODO 5 - 6)
(6) RunFuzzyMatchAgentCSharp (TODO 7 C#)
(7) RunFuzzyMatchAgentFSharp (TODO 7 F#)
(8) AgentAggregate (TODO 8 C#)
=============================================================
");

            var choice      = Console.ReadLine();
            var indexChoice = int.Parse(choice);

            switch (indexChoice)
            {
            case 1:
                await ParallelFuzzyMatch.RunFuzzyMatchTaskComposition(WordsToSearch, files);

                break;

            case 2:
                await ParallelFuzzyMatch.RunFuzzyMatchPLINQ(WordsToSearch, files);

                break;

            case 3:
                ParallelFuzzyMatch.RunFuzzyMatchPipeline(WordsToSearch, files);
                break;

            case 4:
                await ParallelFuzzyMatch.RunFuzzyMatchTaskProcessAsCompleteAbstracted(WordsToSearch, files);

                break;

            case 5:
                await ParallelFuzzyMatch.RunFuzzyMatchDataFlow(WordsToSearch, files);

                break;

            case 6:
                ParallelFuzzyMatch.RunFuzzyMatchAgentCSharp(WordsToSearch, files);
                break;

            case 7:
                await ParallelFuzzyMatch.RunFuzzyMatchAgentFSharp(WordsToSearch, files);

                break;

            case 8:
                AgentAggregate.Run();
                break;

            default:
                throw new Exception("Selection not supported");
            }
        }