recheck
recheck copied to clipboard
Unique differences aren't counted correctly
Quite often, there are more unique differences than "normal" differences.
These normal differences are counted via ActionReplayResult#getElementDifferences()
, whereas the unique differences are counted via ActionReplayResult#getUniqueDifferences()
. As can been seen, getElementDifferences()
simply uses StateDifferences#getNonEmptyDifferences()
, but getUniqueDifferences()
calls getElementDifferences()
and "unwraps" the contained differences (which can be different types).
If we assume that all possible differences of an element are wrapped inside an ElementDifference
, then getUniqueDifferences()
contains at least the number of differences as getElementDifferences()
. But if a single element has multiple differences, e.g., two attribute changes, then getUniqueDifferences()
leads to more differences than getElementDifferences()
.
This is confusing because one expects "unique" to be less than "normal". So, we should probably adapt the naming scheme. For instance:
-
getElementDifferences()
=>getElementDifferences()
since it returns the list of differences of all elements that have changed. -
getUniqueDifferences()
=>getAllDifferences()
since it unwraps eachElementDifference
into one or moreAttributesDifference
,IdentifyingAttributesDifference
,DurationDifference
orInsertedDeletedElementDifference
.
@martin-v isn't this a bug as existing functionality is broken? We want to improve the external quality, not just the internal one. So why refactoring
instead of the bug
?