/// <summary>
        /// Performs an in-place intersection with a BitsetContainer.
        /// </summary>
        /// <param name="other">the BitsetContainer to intersect</param>
        public override Container iand(BitsetContainer other)
        {
            int pos = 0;

            for (int k = 0; k < cardinality; k++)
            {
                ushort v = content[k];
                if (other.contains(v))
                {
                    content[pos++] = v;
                }
            }
            cardinality = pos;
            return(this);
        }
        /// <summary>
        /// Returns the elements of this ArrayContainer that are not in the
        /// other BitSetContainer. Modifies the current container in place.
        /// </summary>
        /// <param name="x">the BitSetContainer to compare against</param>
        /// <returns>A new container with the differences</returns>
        public override Container iandNot(BitsetContainer x)
        {
            int pos = 0;

            for (int k = 0; k < cardinality; ++k)
            {
                ushort v = this.content[k];
                if (!x.contains(v))
                {
                    this.content[pos++] = v;
                }
            }
            this.cardinality = pos;
            return(this);
        }
        /// <summary>
        /// Returns the elements of this ArrayContainer that are not in the
        /// other BitSetContainer.
        /// </summary>
        /// <param name="x">the BitSetContainer to compare against</param>
        /// <returns>A new container with the differences</returns>
        public override Container andNot(BitsetContainer x)
        {
            var answer = new ArrayContainer(content.Length);
            int pos    = 0;

            for (int k = 0; k < cardinality; ++k)
            {
                ushort val = this.content[k];
                if (!x.contains(val))
                {
                    answer.content[pos++] = val;
                }
            }
            answer.cardinality = pos;
            return(answer);
        }
 /// <summary>
 /// Returns the elements of this ArrayContainer that are not in the
 /// other BitSetContainer. Modifies the current container in place.
 /// </summary>
 /// <param name="x">the BitSetContainer to compare against</param>
 /// <returns>A new container with the differences</returns>
 public override Container iandNot(BitsetContainer x)
 {
     int pos = 0;
     for (int k = 0; k < cardinality; ++k)
     {
         ushort v = this.content[k];
         if (!x.contains(v))
             this.content[pos++] = v;
     }
     this.cardinality = pos;
     return this;
 }
 /// <summary>
 /// Performs an in-place intersection with a BitsetContainer.
 /// </summary>
 /// <param name="other">the BitsetContainer to intersect</param>
 public override Container iand(BitsetContainer other)
 {
     int pos = 0;
     for (int k = 0; k < cardinality; k++)
     {
         ushort v = content[k];
         if (other.contains(v))
             content[pos++] = v;
     }
     cardinality = pos;
     return this;
 }
 /// <summary>
 /// Returns the elements of this ArrayContainer that are not in the
 /// other BitSetContainer.
 /// </summary>
 /// <param name="x">the BitSetContainer to compare against</param>
 /// <returns>A new container with the differences</returns>
 public override Container andNot(BitsetContainer x)
 {
     var answer = new ArrayContainer(content.Length);
     int pos = 0;
     for (int k = 0; k < cardinality; ++k)
     {
         ushort val = this.content[k];
         if (!x.contains(val))
             answer.content[pos++] = val;
     }
     answer.cardinality = pos;
     return answer;
 }