예제 #1
0
파일: SET.cs 프로젝트: Vespertan/everest
        public SET <T> Intersection(SET <T> otherset)
        {
            SET <T> retVal = new SET <T>(this.Comparator);

            foreach (T item in this)
            {
                if (otherset.Contains(item))
                {
                    retVal.Add(item);
                }
            }
            return(retVal);
        }
예제 #2
0
파일: SET.cs 프로젝트: Vespertan/everest
        public SET <T> Except(SET <T> otherset)
        {
            SET <T> retVal = new SET <T>();

            foreach (T item in this)
            {
                if (!otherset.Contains(item))
                {
                    retVal.Add(item);
                }
            }
            return(retVal);
        }
예제 #3
0
파일: SET.cs 프로젝트: Vespertan/everest
        /// <summary>
        /// Create a union of this set and another set
        /// </summary>
        public SET <T> Union(T element)
        {
            SET <T> retVal = new SET <T>();

            foreach (T item in this)
            {
                retVal.Add(item);
            }
            if (!retVal.Contains(element))
            {
                retVal.Add(element);
            }
            return(retVal);
        }
예제 #4
0
파일: SET.cs 프로젝트: Vespertan/everest
        public SET <T> Union(SET <T> otherset)
        {
            SET <T> retVal = new SET <T>();

            foreach (T item in this)
            {
                retVal.Add(item);
            }
            foreach (T item in otherset)
            {
                if (!retVal.Contains(item))
                {
                    retVal.Add(item);
                }
            }
            return(retVal);
        }