Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Verification for Decision Model and Notation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Verification for Decision Model and Notation
Commits
3d6d26df
Commit
3d6d26df
authored
5 years ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Add utils functions for dmn check
parent
094f1f4f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/domain/vdmn/utils/VDmnFunctions.java
+46
-5
46 additions, 5 deletions
...blenz/fgbks/core/dmn/domain/vdmn/utils/VDmnFunctions.java
with
46 additions
and
5 deletions
dmnverifierapi/src/main/java/de/unikoblenz/fgbks/core/dmn/domain/vdmn/utils/VDmnFunctions.java
+
46
−
5
View file @
3d6d26df
...
...
@@ -11,7 +11,6 @@ import de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnRule;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VDmnValue
;
import
de.unikoblenz.fgbks.core.dmn.domain.vdmn.VTypeRef
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.Validate
;
...
...
@@ -70,12 +69,54 @@ public class VDmnFunctions {
.
collect
(
Collectors
.
toList
());
}
public
boolean
differentConclusions
(
List
<
VDmnRule
>
ruleIds
)
{
// TODO
public
boolean
differentConclusions
(
List
<
VDmnRule
>
rules
)
{
if
(
rules
.
size
()
==
0
)
{
return
false
;
}
VDmnRule
refRule
=
rules
.
get
(
0
);
for
(
VDmnRule
rule
:
rules
)
{
if
(
differentConclusions
(
refRule
,
rule
))
{
return
true
;
}
}
return
false
;
}
public
List
<
VDmnRule
>
getRulesWithEqualOutput
(
VDmnDecisionTable
dmnDecisionTable
)
{
return
Collections
.
emptyList
();
public
boolean
differentConclusions
(
VDmnRule
oneRule
,
VDmnRule
otherRule
)
{
if
(
oneRule
.
getDmnOutputValues
().
size
()
!=
otherRule
.
getDmnOutputValues
().
size
())
{
return
true
;
}
for
(
int
i
=
0
;
i
<
oneRule
.
getDmnOutputValues
().
size
();
i
++)
{
if
(
oneRule
.
getDmnOutputValues
()
.
get
(
i
)
.
getText
()
.
equals
(
otherRule
.
getDmnOutputValues
().
get
(
0
).
getText
()))
{
return
true
;
}
}
return
false
;
}
public
List
<
List
<
VDmnRule
>>
getRuleClustersWithIdenticalOutput
(
VDmnDecisionTable
dmnDecisionTable
)
{
List
<
List
<
VDmnRule
>>
clusters
=
new
ArrayList
<>();
List
<
VDmnRule
>
remainingRules
=
new
ArrayList
<>(
dmnDecisionTable
.
getRules
());
for
(
int
i
=
0
;
i
<
remainingRules
.
size
();
i
++)
{
List
<
VDmnRule
>
newCluster
=
new
ArrayList
<>();
newCluster
.
add
(
remainingRules
.
get
(
i
));
remainingRules
.
set
(
i
,
null
);
for
(
int
u
=
i
+
1
;
u
<
remainingRules
.
size
();
u
++)
{
if
(
remainingRules
.
get
(
u
)
!=
null
&&
!
differentConclusions
(
newCluster
.
get
(
0
),
remainingRules
.
get
(
u
)))
{
newCluster
.
add
(
remainingRules
.
get
(
u
));
remainingRules
.
set
(
u
,
null
);
}
}
if
(
newCluster
.
size
()
>
1
)
{
clusters
.
add
(
newCluster
);
}
}
return
clusters
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment