Esempio n. 1
0
        private static void SampleUsingSwipeType(SwipeType swipeType)
        {
            Stopwatch stopwatch = new Stopwatch();

            string[] testCases =
            {
                "heqerqllo",
                "qwertyuihgfcvbnjk",
                "wertyuioiuytrtghjklkjhgfd",
                "dfghjioijhgvcftyuioiuytr",
                "aserfcvghjiuytedcftyuytre",
                "asdfgrtyuijhvcvghuiklkjuytyuytre",
                "mjuytfdsdftyuiuhgvc",
                "vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty"
            };

            foreach (var s in testCases)
            {
                stopwatch.Start();
                var result = swipeType.GetSuggestion(s, 10);
                stopwatch.Stop();
                stopwatch.Reset();

                int length = result.Length;
                for (int i = 0; i < length; ++i)
                {
                    i = i;
                    //Console.WriteLine($"match {i + 1}: {result[i]}");
                }
            }
        }
Esempio n. 2
0
        private static void SampleUsingSwipeType(SwipeType swipeType)
        {
            Console.WriteLine($"Test {swipeType.GetType()}");

            Stopwatch stopwatch = new Stopwatch();

            string[] testCases =
            {
                "heqerqllo",
                "qwertyuihgfcvbnjk",
                "wertyuioiuytrtghjklkjhgfd",
                "dfghjioijhgvcftyuioiuytr",
                "aserfcvghjiuytedcftyuytre",
                "asdfgrtyuijhvcvghuiklkjuytyuytre",
                "mjuytfdsdftyuiuhgvc",
                "vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty"
            };

            foreach (var s in testCases)
            {
                Console.WriteLine("#===============================#");
                Console.WriteLine($"Raw string: {s}");

                stopwatch.Start();
                var result = swipeType.GetSuggestion(s, 10);
                stopwatch.Stop();
                Console.WriteLine($"Match time: {stopwatch.ElapsedMilliseconds} ms");
                stopwatch.Reset();

                int length = result.Count();
                for (int i = 0; i < length; ++i)
                {
                    Console.WriteLine($"match {i + 1}: {result.ElementAt(i)}");
                }
            }
        }
Esempio n. 3
0
        public static string[] SampleUsingSwipeType(SwipeType swipeType, string word_pattern)
        {
            Stopwatch stopwatch = new Stopwatch();

            string[] myOptions = new String[3];

            stopwatch.Start();
            var result = swipeType.GetSuggestion(word_pattern, 10);

            stopwatch.Stop();
            stopwatch.Reset();

            int length = result.Length;

            if (length < 1)
            {
                myOptions[0] = "zero";

                myOptions[1] = "zero";

                myOptions[2] = "zero";
            }

            else if (length == 1)
            {
                myOptions[0] = result[0];

                myOptions[1] = "zero";

                myOptions[2] = "zero";
            }

            else if (length == 2)
            {
                myOptions[0] = result[0];

                myOptions[1] = result[1];

                myOptions[2] = "zero";
            }

            else
            {
                myOptions[0] = result[0];

                myOptions[1] = result[1];

                myOptions[2] = result[2];
            }

            return(myOptions);

            //option1.GetComponent<Text>().text = result[0];
            //option2.GetComponent<Text>().text = result[1];
            //option3.GetComponent<Text>().text = result[2];

            for (int i = 0; i < 3; ++i)
            {
                Debug.Log(result[i]);
                //Console.WriteLine(result[i]);
            }

            //string[] testCases =
            //{
            //    "heqerqllo",
            //    "qwertyuihgfcvbnjk",
            //    "wertyuioiuytrtghjklkjhgfd",
            //    "dfghjioijhgvcftyuioiuytr",
            //    "aserfcvghjiuytedcftyuytre",
            //    "asdfgrtyuijhvcvghuiklkjuytyuytre",
            //    "mjuytfdsdftyuiuhgvc",
            //    "vghjioiuhgvcxsasdvbhuiklkjhgfdsaserty"
            //};

            //foreach (var s in testCases)
            //{


            //    stopwatch.Start();
            //    var result = swipeType.GetSuggestion(s, 10);
            //    stopwatch.Stop();
            //    stopwatch.Reset();

            //    int length = result.Length;
            //    for (int i = 0; i < length; ++i)
            //    {
            //        i = i;
            //        //Console.WriteLine($"match {i + 1}: {result[i]}");
            //    }
            //}
        }