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 TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleim()Returns the value of theimrecord component.static booleanstatic booleandoublere()Returns the value of thererecord component.toString()Returns a string representation of this record class.
-
Field Details
-
re
private final double reThe field for thererecord component. -
im
private final double imThe field for theimrecord component. -
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 aComplexrecord class.- Parameters:
re- the value for thererecord componentim- the value for theimrecord 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 thererecord component.- Returns:
- the value of the
rerecord component
-
im
public double im()Returns the value of theimrecord component.- Returns:
- the value of the
imrecord component
-