BitsetsNET.BitsetContainer.And C# (CSharp) Method

And() public method

Computes the bitwise AND of this container with another (intersection). This container as well as the provided container are left unaffected.
public And ( ArrayContainer x ) : Container
x ArrayContainer Other container
return Container
        public override Container And(ArrayContainer x)
        {
            ArrayContainer answer = new ArrayContainer(x.Content.Length);
            int c = x.Cardinality;
            for (int i=0; i<c; i++)
            {
                ushort v = x.Content[i];
                if (this.Contains(v))
                {
                    answer.Content[answer.Cardinality++] = v;
                }
            }
            return answer;
        }

Same methods

BitsetContainer::And ( BitsetContainer x ) : Container

Usage Example

Example #1
0
 /// <summary>
 /// Computes the bitwise AND of this container with another
 /// (intersection). This container as well as the provided container are
 /// left unaffected.
 /// </summary>
 /// <param name="x">Other container</param>
 /// <returns>Aggregated container</returns>
 public override Container And(BitsetContainer x)
 {
     return(x.And(this));
 }
All Usage Examples Of BitsetsNET.BitsetContainer::And