[jboss-jira] [JBoss JIRA] (DROOLS-1543) DMN ItemDefinition dependencies ordering
Matteo Mortari (JIRA)
issues at jboss.org
Tue May 2 07:28:00 EDT 2017
[ https://issues.jboss.org/browse/DROOLS-1543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400597#comment-13400597 ]
Matteo Mortari commented on DROOLS-1543:
----------------------------------------
Additionally, furhter modifying such described Comparator in the only case of independency, to further order alphabetically by name, would introduce potential inconsistencies across the total ordering.
Assume the following:
{code:java}
Z
B
A -> Z
{code}
where B is independent from A, Z; and A depends on Z hence by definition A > Z.
{code:java}
A > Z // by definition as A depends on Z.
B < Z // comparing b with z, because they are independent, order them by name
A < B // comparing a with b because they are independent, order them by name
{code}
At this point the inconsistency is revealed over the total ordering because:
{code:java}
A < B < Z // descends from the last 2 comparison
inconsistent with:
A > Z // was the original by definition
{code}
> DMN ItemDefinition dependencies ordering
> ----------------------------------------
>
> Key: DROOLS-1543
> URL: https://issues.jboss.org/browse/DROOLS-1543
> Project: Drools
> Issue Type: Bug
> Reporter: Matteo Mortari
> Assignee: Matteo Mortari
>
> 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:
> {code:java}
> X
> Y -> Z
> {code}
> where X is independent from Y, Z; and Y depends on Z.
> {code:java}
> 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.
> {code}
> The above breaks the API contract in the Java-API Comparator where stating:
> {quote}Finally, the implementor must ensure that compare(x, y)==0 implies that sgn(compare(x, z))==sgn(compare(y, z)) for all z.{quote}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
More information about the jboss-jira
mailing list