예제 #1
0
        // static methods
        public static Monom <T> Multiply(Monom <T> first, Monom <T> second)
        {
            Monom <T> result = (Monom <T>)first.Clone();

            result.Multiply(second);
            return(result);
        }
예제 #2
0
        public static Monom <T> Divide(Monom <T> first, Monom <T> second)
        {
            Monom <T> result = (Monom <T>)first.Clone();

            result.Divide(second);
            return(result);
        }
예제 #3
0
        public static Monom <T> Negate(Monom <T> monom)
        {
            Monom <T> result = (Monom <T>)monom.Clone();

            result.InverseAdditive();
            return(result);
        }
예제 #4
0
        // IComparable
        public int CompareTo(Monom <T> other)
        {
            int compareRes = Degree.CompareTo(other.Degree);

            if (compareRes != 0)
            {
                return(compareRes);
            }
            return(Coef.CompareTo(other.Coef));
        }
예제 #5
0
 public void Divide(Monom <T> another)
 {
     Coef.Divide(another.Coef);
     Degree -= another.Degree;
 }
예제 #6
0
 public void Multiply(Monom <T> another)
 {
     Coef.Multiply(another.Coef);
     Degree += another.Degree;
 }
예제 #7
0
 int IComparable <Monom <T> > .CompareTo(Monom <T> other) => CompareTo(other);