Class FloatingPointTolerantDifferenceListener

  • All Implemented Interfaces:
    DifferenceListener

    public class FloatingPointTolerantDifferenceListener
    extends TextDifferenceListenerBase
    Expects texts to be floating point numbers and treats them as identical if they only differ by a given tolerance value (or less).

    This implementation uses an absolute tolerance value value for all numbers encountered, calculating a difference relative to one of the numbers compared might be more appropriate in general.

    • Field Detail

      • tolerance

        private final double tolerance
    • Constructor Detail

      • FloatingPointTolerantDifferenceListener

        public FloatingPointTolerantDifferenceListener​(DifferenceListener delegateTo,
                                                       double tolerance)
        Creates a new instance
        Parameters:
        delegateTo - the DifferenceListener to delegate to.
        tolerance - absolute tolerance value for numerical differences