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 SummaryFieldsModifier and TypeFieldDescriptionstatic final doubleDefault tolerance used by the comparator.
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a new comparator with aDEFAULT_EPSILONtolerance.ToleranceDoubleComparator(double epsilon) Construct a new comparator with a specified tolerance.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparatorequals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
- 
Field Details- 
DEFAULT_EPSILONpublic static final double DEFAULT_EPSILONDefault tolerance used by the comparator.- See Also:
 
 
- 
- 
Constructor Details- 
ToleranceDoubleComparatorpublic ToleranceDoubleComparator()Construct a new comparator with aDEFAULT_EPSILONtolerance.
- 
ToleranceDoubleComparatorpublic ToleranceDoubleComparator(double epsilon) Construct a new comparator with a specified tolerance.- Parameters:
- epsilon- the tolerance
 
 
- 
- 
Method Details- 
compareCompares two floating point values. Returns 0 if they are equal, -1 if o1 < o2, 1 otherwise- Specified by:
- comparein interface- Comparator<Double>
- Parameters:
- o1- the first value
- o2- the second value
- Returns:
- 0 if they are equal, -1 if o1 < o2, 1 otherwise
 
 
-