Class AbstractPoly

java.lang.Object
it.unimi.di.prog2.h19.AbstractPoly
All Implemented Interfaces:
Poly, Iterable<Poly.Term>
Direct Known Subclasses:
DensePoly, SparsePoly

public abstract class AbstractPoly extends Object implements Poly
A partial implementation of a Poly.
  • Field Details

    • degree

      private final int degree
      The degree of the polinomial.
  • Constructor Details

    • AbstractPoly

      protected AbstractPoly(int degree)
      Initializes this to be the a polynomial with given degree.
      Parameters:
      degree - the degree.
      Throws:
      IllegalArgumentException - if n is not positive.
  • Method Details

    • degree

      public int degree()
      Description copied from interface: Poly
      Returns the degree of this polynomial.
      Specified by:
      degree in interface Poly
      Returns:
      the largest exponent with a non-zero coefficient; returns 0 if this is the zero Poly.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object