BitsetsNET.ArrayContainer.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 value2 ) : Container
value2 ArrayContainer
return Container
        public override Container And(ArrayContainer value2)
        {
            ArrayContainer value1 = this;
            int desiredCapacity = Math.Min(value1.GetCardinality(), value2.GetCardinality());
            ArrayContainer answer = new ArrayContainer(desiredCapacity);
            answer.Cardinality = Utility.UnsignedIntersect2by2(value1.Content,
                                                               value1.GetCardinality(),
                                                               value2.Content,
                                                               value2.GetCardinality(),
                                                               answer.Content);
            return answer;
        }

Same methods

ArrayContainer::And ( BitsetContainer x ) : Container

Usage Example

Example #1
0
 /// <summary>
 /// Performs an "in-place" intersection with an ArrayContainer. Since
 /// no in-place operation is actually possible, this method defaults to
 /// calling ArrayContainer's and() method with this as input.
 /// </summary>
 /// <param name="other">the ArrayContainer to intersect</param>
 public override Container IAnd(ArrayContainer other)
 {
     return(other.And(this)); // No in-place possible
 }
All Usage Examples Of BitsetsNET.ArrayContainer::And