java.lang.Object
org.jgrapht.alg.util.ToleranceDoubleComparator
- All Implemented Interfaces:
 Serializable,Comparator<Double>
A double comparator with adjustable tolerance.
- Author:
 - Dimitrios Michail
 - See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleDefault tolerance used by the comparator. - 
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new comparator with aDEFAULT_EPSILONtolerance.ToleranceDoubleComparator(double epsilon) Construct a new comparator with a specified tolerance. - 
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong 
- 
Field Details
- 
DEFAULT_EPSILON
public static final double DEFAULT_EPSILONDefault tolerance used by the comparator.- See Also:
 
 
 - 
 - 
Constructor Details
- 
ToleranceDoubleComparator
public ToleranceDoubleComparator()Construct a new comparator with aDEFAULT_EPSILONtolerance. - 
ToleranceDoubleComparator
public ToleranceDoubleComparator(double epsilon) Construct a new comparator with a specified tolerance.- Parameters:
 epsilon- the tolerance
 
 - 
 - 
Method Details
- 
compare
Compares two floating point values. Returns 0 if they are equal, -1 if o1 < o2, 1 otherwise- Specified by:
 comparein interfaceComparator<Double>- Parameters:
 o1- the first valueo2- the second value- Returns:
 - 0 if they are equal, -1 if o1 < o2, 1 otherwise
 
 
 -