Esempio n. 1
0
        /// <summary>
        /// Compares the element to another.
        /// </summary>
        /// <param name="obj">Other element to compare against.</param>
        /// <returns>If elements are equal.</returns>
        public override bool Equals(object obj)
        {
            ObjectMatrix Matrix = obj as ObjectMatrix;

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

            if (this.columns != Matrix.columns || this.rows != Matrix.rows)
            {
                return(false);
            }

            IElement[,] V1 = this.Values;
            IElement[,] V2 = Matrix.Values;
            int x, y;

            for (y = 0; y < this.rows; y++)
            {
                for (x = 0; x < this.columns; x++)
                {
                    if (V1[y, x] != V2[y, x])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Checks if the set contains an element.
        /// </summary>
        /// <param name="Element">Element.</param>
        /// <returns>If the element is contained in the set.</returns>
        public override bool Contains(IElement Element)
        {
            ObjectMatrix M = Element as ObjectMatrix;

            if (M is null)
            {
                return(false);
            }

            return(M.Rows == this.rows && M.Columns == this.columns);
        }