recheck icon indicating copy to clipboard operation
recheck copied to clipboard

Unique differences aren't counted correctly

Open beatngu13 opened this issue 6 years ago • 1 comments

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 each ElementDifference into one or more AttributesDifference, IdentifyingAttributesDifference, DurationDifference or InsertedDeletedElementDifference.

beatngu13 avatar Jan 30 '19 11:01 beatngu13

@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?

beatngu13 avatar Apr 24 '19 07:04 beatngu13