Record Class Complex

java.lang.Object
java.lang.Record
rocks.palaiologos.maja.Complex

@Desugar public record Complex(double re, double im) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Complex
     
    static final Complex
     
    static final Complex
     
    static final Complex
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a complex value with zero real and imaginary parts.
    Complex(double re)
    Construct a complex value with the given real part and zero imaginary part.
    Complex(double re, double im)
    Creates an instance of a Complex record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    double
    im()
    Returns the value of the im record component.
    static boolean
     
    static boolean
     
    double
    re()
    Returns the value of the re record component.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NaN

      public static final Complex NaN
    • COMPLEX_INFINITY

      public static final Complex COMPLEX_INFINITY
    • ZERO

      public static final Complex ZERO
    • ONE

      public static final Complex 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 a Complex record class.
      Parameters:
      re - the value for the re record component
      im - the value for the im record component
  • Method Details

    • isNaN

      public static boolean isNaN(Complex c)
    • isInfinite

      public static boolean isInfinite(Complex c)
    • equals

      public boolean equals(Object o)
      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 '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • re

      public double re()
      Returns the value of the re record component.
      Returns:
      the value of the re record component
    • im

      public double im()
      Returns the value of the im record component.
      Returns:
      the value of the im record component