Details
-
Bug
-
Resolution: Done
-
Major
-
7.0.0.CR3
-
None
-
NEW
-
NEW
Description
Using Java-api Comparator is not easily suitable to address the problem of ordering the ItemDefinition by their dependencies.
If the Comparator is used to check purely for dependencies, returning 0 for indipendent elements, assume the following:
X Y -> Z
where X is independent from Y, Z; and Y depends on Z.
compare(X, Y) == 0 // by definition above compare(X, Z) == 0 // still, by definition above, X is independent also from Z compare(Y, Z) == 1 // because Y depends on Z, Y is bigger than Z.
The above breaks the API contract in the Java-API Comparator where stating:
Finally, the implementor must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.