示例#1
0
        public int CompareTo(SET <TKey> that)
        {
            var union = Union(that);

            if (_set.Size() == that.Size() && _set.Size() == union.Size() && that.Size() == union.Size())
            {
                return(0);
            }
            if (_set.Size() < that.Size())
            {
                return(-1);
            }
            return(1);
        }
示例#2
0
        /// <summary>
        /// Returns the union of this set and that set.
        /// </summary>
        /// <param name="that">that the other set</param>
        /// <returns>the union of this set and that set</returns>
        /// <exception cref="NullReferenceException">if <tt>that</tt> is <tt>null</tt></exception>
        public SET <TKey> Union(SET <TKey> that)
        {
            if (that == null)
            {
                throw new NullReferenceException("called union() with a null argument");
            }
            var c = new SET <TKey>();

            foreach (var x in this)
            {
                c.Add(x);
            }
            foreach (var x in that)
            {
                c.Add(x);
            }
            return(c);
        }
示例#3
0
 public BlackFilter(IEnumerable <string> a)
 {
     _filter = new SET <string>();;
     InsertWords(a);
 }
示例#4
0
 public DeDup(IEnumerable <string> a)
 {
     _set = new SET <string>();;
     InsertWords(a);
 }