// 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); }
public static Monom <T> Divide(Monom <T> first, Monom <T> second) { Monom <T> result = (Monom <T>)first.Clone(); result.Divide(second); return(result); }
public static Monom <T> Negate(Monom <T> monom) { Monom <T> result = (Monom <T>)monom.Clone(); result.InverseAdditive(); return(result); }
// IComparable public int CompareTo(Monom <T> other) { int compareRes = Degree.CompareTo(other.Degree); if (compareRes != 0) { return(compareRes); } return(Coef.CompareTo(other.Coef)); }
public void Divide(Monom <T> another) { Coef.Divide(another.Coef); Degree -= another.Degree; }
public void Multiply(Monom <T> another) { Coef.Multiply(another.Coef); Degree += another.Degree; }
int IComparable <Monom <T> > .CompareTo(Monom <T> other) => CompareTo(other);