Esempio n. 1
0
        /// <summary>
        /// Compares the contents of two instances to see if they are equal.
        /// </summary>
        /// <param name="obj">is the object to compare to.</param>
        /// <returns>True if the contents of the objects are equal.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!GetType().Equals(obj.GetType()))
            {
                return(false);
            }
            BloomFilter other = (BloomFilter)obj;

            if (expectedNumberOfFilterElements != other.expectedNumberOfFilterElements)
            {
                return(false);
            }
            if (hashFuncNumber != other.hashFuncNumber)
            {
                return(false);
            }
            if (bitSetSize != other.bitSetSize)
            {
                return(false);
            }
            if (bitSet != other.bitSet && (bitSet == null || !bitSet.Compare(other.bitSet)))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public void UpdateField(BitArray updated, int upPiece, int downPiece)
        {
            if (updated == null && Field != null)
            {
                Redraw = true;
            }

            else if (updated != null && Field == null)
            {
                Redraw = true;
            }

            else if (updated != null && (Up != upPiece || Down != downPiece || !updated.Compare(Field)))
            {
                Redraw = true;
            }

            Field = (updated != null) ? new BitArray(updated) : null;
            Up    = upPiece;
            Down  = downPiece;

            Invalidate();
        }