Exemplo n.º 1
0
 /// <summary>
 /// Check polynomials
 /// </summary>
 /// <param name="p1">First polinomial</param>
 /// <param name="p2">Second polinomial</param>
 private static void Check(My_Polynomial p1, My_Polynomial p2)
 {
     if (p1 == null || p2 == null)
     {
         throw new ArgumentNullException();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Equals polynomials
        /// </summary>
        /// <param name="obj">Object</param>
        /// <returns>Equality objects</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            My_Polynomial p1 = obj as My_Polynomial;

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

            for (int i = 0; i < p1.Degree; i++)
            {
                if (p1.coefficient[i] != coefficient[i])
                {
                    return(false);
                }
            }

            return(true);
        }