Class ToleranceDoubleComparator

    • Field Detail

      • DEFAULT_EPSILON

        public static final double DEFAULT_EPSILON
        Default tolerance used by the comparator.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ToleranceDoubleComparator

        public ToleranceDoubleComparator()
        Construct a new comparator with a DEFAULT_EPSILON tolerance.
      • ToleranceDoubleComparator

        public ToleranceDoubleComparator​(double epsilon)
        Construct a new comparator with a specified tolerance.
        Parameters:
        epsilon - the tolerance
    • Method Detail

      • compare

        public int compare​(Double o1,
                           Double o2)
        Compares two floating point values. Returns 0 if they are equal, -1 if o1 < o2, 1 otherwise
        Specified by:
        compare in interface Comparator<Double>
        Parameters:
        o1 - the first value
        o2 - the second value
        Returns:
        0 if they are equal, -1 if o1 < o2, 1 otherwise