Set() public method

If the value is true and given index is not in the set add it. If the value is false and the index is in the set remove it. Otherwise, do nothing.
public Set ( int index, bool value ) : void
index int the index to set
value bool
return void
コード例 #1
0
        public IBitset Difference(IBitset otherSet)
        {
            UncompressedBitArray workset = null;

            if (otherSet is UncompressedBitArray)
            {
                workset = (UncompressedBitArray)otherSet;
            }
            else
            {
                throw new InvalidOperationException("otherSet is not an UncompressedBitArray");
            }

            UncompressedBitArray newArray = (UncompressedBitArray)this.Clone();

            for (int i = 0; i < workset._Array.Length; i++)
            {
                if (workset._Array[i] && i < this.Length())
                {
                    newArray.Set(i, false);
                }
            }

            return(newArray);
        }