Package rocks.palaiologos.maja
Record Class Complex
java.lang.Object
java.lang.Record
rocks.palaiologos.maja.Complex
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
im()
Returns the value of theim
record component.static boolean
static boolean
double
re()
Returns the value of there
record component.toString()
Returns a string representation of this record class.
-
Field Details
-
NaN
-
COMPLEX_INFINITY
-
ZERO
-
ONE
-
-
Constructor Details
-
Complex
public Complex(double re) Construct a complex value with the given real part and zero imaginary part.- Parameters:
re
-
-
Complex
public Complex()Construct a complex value with zero real and imaginary parts. -
Complex
public Complex(double re, double im) Creates an instance of aComplex
record class.- Parameters:
re
- the value for there
record componentim
- the value for theim
record component
-
-
Method Details
-
isNaN
-
isInfinite
-
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 '=='. -
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. -
re
public double re()Returns the value of there
record component.- Returns:
- the value of the
re
record component
-
im
public double im()Returns the value of theim
record component.- Returns:
- the value of the
im
record component
-