Beispiel #1
0
        /// <summary>
        /// Substract keys
        /// </summary>
        /// <param name="ls"></param>
        /// <returns></returns>
        public LongSet Minus(LongSet ls)
        {
            LongSet rv = new LongSet(this);

            foreach (long v in keys)
            {
                if (ls.Exist(v))
                {
                    rv.Remove(v);
                }
            }
            return(rv);
        }
Beispiel #2
0
 /// <summary>
 /// Intersects sets
 /// </summary>
 /// <param name="ls"></param>
 /// <returns></returns>
 public LongSet Intersect(LongSet ls)
 {
     if (this._size > ls._size)
     {
         return(ls.Union(this));
     }
     else
     {
         LongSet rv = new LongSet();
         foreach (long v in keys)
         {
             if (ls.Exist(v))
             {
                 rv.Add(v);
             }
         }
         return(rv);
     }
 }
        /// <summary>
        /// Clone
        /// </summary>
        /// <returns></returns>
		public LongSet Clone()
		{
			LongSet ls = new LongSet(this);
			return ls;
		}
        /// <summary>
        /// Long set from another long set
        /// </summary>
        /// <param name="ls"></param>
		public LongSet( LongSet ls )
		{
			keys = new long[ls.keys.Length];
			ls.keys.CopyTo(keys,0);
			_size=ls._size;
		}
        /// <summary>
        /// Intersects sets
        /// </summary>
        /// <param name="ls"></param>
        /// <returns></returns>
		public LongSet Intersect( LongSet ls )
		{
			if(this._size>ls._size)
				return ls.Union(this);
			else
			{
				LongSet rv = new LongSet();
				foreach(long v in keys)
				{
					if(ls.Exist(v))
						rv.Add(v);
				}
				return rv;
			}
		}
        /// <summary>
        /// Substract keys
        /// </summary>
        /// <param name="ls"></param>
        /// <returns></returns>
		public LongSet Minus( LongSet ls )
		{
			LongSet rv = new LongSet(this);
			foreach(long v in keys)
			{
				if(ls.Exist(v))
					rv.Remove(v);
			}
			return rv;
		}
Beispiel #7
0
        /// <summary>
        /// Clone
        /// </summary>
        /// <returns></returns>
        public LongSet Clone()
        {
            LongSet ls = new LongSet(this);

            return(ls);
        }
Beispiel #8
0
 /// <summary>
 /// Long set from another long set
 /// </summary>
 /// <param name="ls"></param>
 public LongSet(LongSet ls)
 {
     keys = new long[ls.keys.Length];
     ls.keys.CopyTo(keys, 0);
     _size = ls._size;
 }