Exemple #1
0
        /// <summary>
        /// Decides whether the given object <c>other</c> is the same as this field
        /// </summary>
        ///
        /// <param name="Obj">The object for comparison</param>
        ///
        /// <returns>Returns <c>(this == other)</c></returns>
        public override bool Equals(Object Obj)
        {
            if (Obj == null || !(Obj is GF2nField))
            {
                return(false);
            }

            GF2nField otherField = (GF2nField)Obj;

            if (otherField.DegreeN != DegreeN)
            {
                return(false);
            }
            if (!FieldPoly.Equals(otherField.FieldPoly))
            {
                return(false);
            }
            if ((this is GF2nPolynomialField) && !(otherField is GF2nPolynomialField))
            {
                return(false);
            }
            if ((this is GF2nONBField) && !(otherField is GF2nONBField))
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Compare this element with another object
        /// </summary>
        ///
        /// <param name="Obj">The object for comprison</param>
        ///
        /// <returns>Returns <c>true</c> if the two objects are equal, <c>false</c> otherwise</returns>
        public override bool Equals(Object Obj)
        {
            if (Obj == null || !(Obj is GF2nPolynomialElement))
            {
                return(false);
            }

            GF2nPolynomialElement otherElem = (GF2nPolynomialElement)Obj;

            if (mField != otherElem.mField)
            {
                if (!mField.FieldPolynomial.Equals(otherElem.mField.FieldPolynomial))
                {
                    return(false);
                }
            }

            return(polynomial.Equals(otherElem.polynomial));
        }