Пример #1
0
        //
        // Difference
        //
        public static Language Difference(Language A, Language B)
        {
            var result = new Language();

            for (int i = 0; i < A.Charsets.Count; i++)
            {
                if (B.ExistsOnList(A.Charsets[i]) == -1)
                {
                    result.InsertCharset(A.Charsets[i]);
                }
            }

            return(result);
        }
Пример #2
0
        //
        // Intersection
        //
        public static Language Intersection(Language languageA, Language languageB)
        {
            var result = new Language();

            String ACharset = "";

            for (int i = 0; i < languageA.Charsets.Count; i++)
            {
                ACharset = languageA.Charsets[i];

                if (languageB.ExistsOnList(ACharset) != -1)
                {
                    result.InsertCharset(ACharset);
                }
            }

            return(result);
        }
Пример #3
0
        //
        // Complement
        //
        public static Language Complement(Language A, Language universe)
        {
            var result = new Language();

            Console.WriteLine("A: " + A.GetCharsets());
            Console.WriteLine("Universe: " + universe.GetCharsets());

            for (int i = 0; i < universe.Charsets.Count; i++)
            {
                if (A.ExistsOnList(universe.Charsets[i]) != -1)
                {
                    continue;
                }
                else
                {
                    result.InsertCharset(universe.Charsets[i]);
                    Console.WriteLine("I: " + i + ", result: " + result.GetCharsets());
                }
            }

            return(result);
        }