Exemplo n.º 1
0
        /// <summary>
        /// Realiza a união com o conjunto informado.
        /// </summary>
        /// <param name="ses"></param>
        /// <returns></returns>
        public StringExpressionSet Union(StringExpressionSet ses)
        {
            if ((ses == null) || ses.IsEmpty())
            {
                return(this.Copy());
            }
            if (this.IsEmpty())
            {
                return(ses.Copy());
            }
            this.CheckList();
            ses.CheckList();
            StringExpressionSet set  = (ses._list.Count > _list.Count) ? ses : this;
            StringExpressionSet set2 = (ses._list.Count <= _list.Count) ? ses : this;
            StringExpressionSet set3 = set.Copy();

            set3.Reduce();
            for (int i = 0; i < set2._list.Count; i++)
            {
                set3.AddSingleExpressionNoDuplicates(set2._list[i]);
            }
            set3.GenerateString();
            return(set3);
        }