Beispiel #1
0
        public PowerSet <T> Intersection(PowerSet <T> set2)
        {
            var intersection = new PowerSet <T>();

            foreach (var val in set2.ToArray())
            {
                if (this.Get(val))
                {
                    intersection.Put(val);
                }
            }
            return(intersection);
        }
Beispiel #2
0
        public bool IsSubset(PowerSet <T> set2)
        {
            var subSet = set2.ToArray();

            foreach (var element in subSet)
            {
                if (!this.Get(element))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #3
0
        public PowerSet <T> Union(PowerSet <T> set2)
        {
            var union = new PowerSet <T>();

            foreach (var val in set2.ToArray())
            {
                union.Put(val);
            }

            foreach (var val in this.ToArray())
            {
                union.Put(val);
            }

            return(union);
        }