Class FloatingPointTolerantDifferenceListener
- java.lang.Object
-
- org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
-
- org.custommonkey.xmlunit.examples.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 Summary
Fields Modifier and Type Field Description private double
tolerance
-
Fields inherited from interface org.custommonkey.xmlunit.DifferenceListener
RETURN_ACCEPT_DIFFERENCE, RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL, RETURN_IGNORE_DIFFERENCE_NODES_SIMILAR, RETURN_UPGRADE_DIFFERENCE_NODES_DIFFERENT
-
-
Constructor Summary
Constructors Constructor Description FloatingPointTolerantDifferenceListener(DifferenceListener delegateTo, double tolerance)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
textualDifference(Difference d)
Delegates to the nested DifferenceListener.-
Methods inherited from class org.custommonkey.xmlunit.examples.TextDifferenceListenerBase
attributeDifference, cdataDifference, commentDifference, differenceFound, skippedComparison, textDifference
-
-
-
-
Constructor Detail
-
FloatingPointTolerantDifferenceListener
public FloatingPointTolerantDifferenceListener(DifferenceListener delegateTo, double tolerance)
-
-
Method Detail
-
textualDifference
protected int textualDifference(Difference d)
Description copied from class:TextDifferenceListenerBase
Delegates to the nested DifferenceListener.- Overrides:
textualDifference
in classTextDifferenceListenerBase
-
-