Record Class SparsePoly.Term
java.lang.Object
java.lang.Record
it.unimi.di.prog2.h09.SparsePoly.Term
- Record Components:
coefficient
- the coefficient.degree
- the degree.
- Enclosing class:
SparsePoly
A record holding a non-zero term of the polynomial.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
The field for thecoefficient
record component.private final int
The field for thedegree
record component. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of thecoefficient
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
-
coefficient
private final int coefficientThe field for thecoefficient
record component. -
degree
private final int degreeThe field for thedegree
record component.
-
-
Constructor Details
-
Term
public Term(int coefficient, int degree) Builds a term.- Throws:
IllegalArgumentException
- ifn
< 0.
-
-
Method Details
-
toString
-
hashCode
-
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 thecompare
method from their corresponding wrapper classes. -
coefficient
public int coefficient()Returns the value of thecoefficient
record component.- Returns:
- the value of the
coefficient
record component
-
degree
-