Package org.hipparchus.complex
Class ComplexComparator
java.lang.Object
org.hipparchus.complex.ComplexComparator
- All Implemented Interfaces:
Serializable
,Comparator<Complex>
Comparator for Complex Numbers.
- See Also:
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
ComplexComparator
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
-
compare
Compare two complex numbers, using real ordering as the primary sort order and imaginary ordering as the secondary sort order.- Specified by:
compare
in interfaceComparator<Complex>
- Parameters:
o1
- first complex numbero2
- 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
-