CyrusBuilt.MonoPi.BitSet.CheckInvariants C# (CSharp) Method

CheckInvariants() private method

Every public method must preserve the invariants. This method checks to see if this is true using assertions.
private CheckInvariants ( ) : void
return void
		private void CheckInvariants() {
			Debug.Assert((this._wordsInUse == 0) || (this._bits[this._wordsInUse - 1] != 0));
			Debug.Assert((this._wordsInUse >= 0) && (this._wordsInUse <= this._bits.Length));
			Debug.Assert((this._wordsInUse == this._bits.Length) || (this._bits[this._wordsInUse] == 0));
		}

Usage Example

示例#1
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is
        /// equal to the current <see cref="CyrusBuilt.MonoPi.BitSet"/>.
        /// </summary>
        /// <param name="obj">
        /// The <see cref="System.Object"/> to compare with the current <see cref="CyrusBuilt.MonoPi.BitSet"/>.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="System.Object"/> is equal to the current
        /// <see cref="CyrusBuilt.MonoPi.BitSet"/>; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            BitSet bs = obj as BitSet;

            if (bs == null)
            {
                return(false);
            }

            this.CheckInvariants();
            bs.CheckInvariants();

            if (this._wordsInUse != bs._wordsInUse)
            {
                return(false);
            }

            Boolean result = true;

            for (Int32 i = 0; i < this._wordsInUse; i++)
            {
                if (this._bits[i] != bs._bits[i])
                {
                    result = false;
                    break;
                }
            }
            return(result);
        }
All Usage Examples Of CyrusBuilt.MonoPi.BitSet::CheckInvariants