Exemple #1
0
        private static void Main(string[] args)
        {
            #region 1 small file

            args = new[] { "File1.txt" };

            var task1 = SearchSubstring.FindSubstrings(args, "Justo donec");
            Task.WaitAll(task1);

            Console.WriteLine("App 1 finished\n");

            var task2 = SecondApp.SearchSubstring.SearchEvenWords(args);
            Task.WaitAll(task2);

            Console.WriteLine("App 2 finished\n");

            #endregion

            #region 2 small+medium file

            args = new[] { "File1.txt", "File2.txt" };

            task1 = SearchSubstring.FindSubstrings(args, "Justo donec");
            Task.WaitAll(task1);

            Console.WriteLine("App 1 finished\n");

            task2 = SecondApp.SearchSubstring.SearchEvenWords(args);
            Task.WaitAll(task2);

            Console.WriteLine("App 2 finished\n");

            #endregion

            #region 3 small+medium+big file

            args = new[] { "File1.txt", "File2.txt", "File3.txt" };

            task1 = SearchSubstring.FindSubstrings(args, "Justo donec");
            Task.WaitAll(task1);

            Console.WriteLine("App 1 finished\n");

            task2 = SecondApp.SearchSubstring.SearchEvenWords(args);
            Task.WaitAll(task2);

            Console.WriteLine("App 2 finished\n");

            #endregion
        }
Exemple #2
0
        static void Main(string[] args)
        {
            List <Lexeme>  lexemes   = ReadLexemes();
            List <Automat> automates = new List <Automat>();
            CreateAutomat  ca        = new CreateAutomat();

            for (int i = 0; i < lexemes.Count; i++) //внешний цикл по все лексемам
            {
                Console.WriteLine(lexemes[i].regex);
                Automat automat = new Automat(lexemes[i].name, lexemes[i].priority, lexemes[i].regex);
                automat = ca.Create(automat);
                automates.Add(automat);
            }
            SearchSubstring task = new SearchSubstring();

            task.Start(automates);
        }