Class ComplexComparator

java.lang.Object
org.hipparchus.complex.ComplexComparator
All Implemented Interfaces:
Serializable, Comparator<Complex>

public class ComplexComparator extends Object implements Comparator<Complex>, Serializable
Comparator for Complex Numbers.
See Also:
  • Constructor Details Link icon

    • ComplexComparator Link icon

      public ComplexComparator()
      Empty constructor.

      This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.

      Since:
      3.0
  • Method Details Link icon

    • compare Link icon

      public int compare(Complex o1, Complex o2)
      Compare two complex numbers, using real ordering as the primary sort order and imaginary ordering as the secondary sort order.
      Specified by:
      compare in interface Comparator<Complex>
      Parameters:
      o1 - first complex number
      o2 - second complex number
      Returns:
      a negative value if o1 real part is less than o2 real part or if real parts are equal and o1 imaginary part is less than o2 imaginary part