Package org.assertj.core.util
Class DoubleComparator
java.lang.Object
org.assertj.core.util.DoubleComparator
- All Implemented Interfaces:
Comparator<Double>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
closeEnough
(Double x, Double y, double epsilon) int
private static boolean
complexCloseEnough
(double a, double b, double epsilon) handles floating point comparison according to http://floating-point-gui.de/errors/comparison/boolean
double
int
hashCode()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
epsilon
private double epsilon
-
-
Constructor Details
-
DoubleComparator
public DoubleComparator(double epsilon)
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<Double>
-
getEpsilon
public double getEpsilon() -
complexCloseEnough
private static boolean complexCloseEnough(double a, double b, double epsilon) handles floating point comparison according to http://floating-point-gui.de/errors/comparison/ -
closeEnough
-
hashCode
public int hashCode() -
equals
- Specified by:
equals
in interfaceComparator<Double>
- Overrides:
equals
in classObject
-