Contains() public method

Checks whether the container contains the provided value.
public Contains ( ushort x ) : bool
x ushort Value to check
return bool
Esempio n. 1
0
        /// <summary>
        /// Computes the in-place bitwise AND of this container with another
        /// (intersection). The current container is generally modified, whereas
        /// the provided container (x) is unaffected. May generate a new container.
        /// </summary>
        /// <param name="x">Other container</param>
        /// <returns>Aggregated container</returns>
        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);
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <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);
        }
Esempio n. 4
0
 /// <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;
 }
Esempio n. 5
0
 /// <summary>
 /// Computes the in-place bitwise AND of this container with another
 /// (intersection). The current container is generally modified, whereas
 /// the provided container (x) is unaffected. May generate a new container.
 /// </summary>
 /// <param name="x">Other container</param>
 /// <returns>Aggregated container</returns>
 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;
 }
Esempio n. 6
0
 /// <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;
 }