BitsetsNET.BitsetContainer.Contains C# (CSharp) Method

Contains() public method

Checks whether the container contains the provided value.
public Contains ( ushort x ) : bool
x ushort Value to check
return bool
        public override bool Contains(ushort x)
        {
            return (Bitmap[x / 64] & (1L << x)) != 0;
        }

Usage Example

Example #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);
        }
All Usage Examples Of BitsetsNET.BitsetContainer::Contains