Package it.unimi.di.prog2.h11
Record Class SparsePoly.Term
java.lang.Object
java.lang.Record
it.unimi.di.prog2.h11.SparsePoly.Term
- Enclosing class:
- SparsePoly
A record holding a term of the polynomial.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
coeff()
Returns the value of thecoeff
record component.int
degree()
Returns the value of thedegree
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
coeff
private final int coeffThe field for thecoeff
record component. -
degree
private final int degreeThe field for thedegree
record component.
-
-
Constructor Details
-
Term
public Term(int coeff, int degree) Builds a term.- Parameters:
coeff
- the coefficient.degree
- the degree.- Throws:
IllegalArgumentException
- ifn
< 0 orc
is 0.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
coeff
public int coeff()Returns the value of thecoeff
record component.- Returns:
- the value of the
coeff
record component
-
degree
public int degree()Returns the value of thedegree
record component.- Returns:
- the value of the
degree
record component
-