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
ab8c5263
Commit
ab8c5263
authored
1 year ago
by
Jonas Blatt
Browse files
Options
Downloads
Patches
Plain Diff
#36
Add Circular DRD Verifier
parent
bdcbab52
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/ps/core/dmn/verification/verifier/impl/CircularDRDVerifier.java
+69
-0
69 additions, 0 deletions
...e/dmn/verification/verifier/impl/CircularDRDVerifier.java
with
69 additions
and
0 deletions
dmnverifierapi/src/main/java/de/unikoblenz/ps/core/dmn/verification/verifier/impl/CircularDRDVerifier.java
0 → 100644
+
69
−
0
View file @
ab8c5263
package
de.unikoblenz.ps.core.dmn.verification.verifier.impl
;
import
de.unikoblenz.ps.base.domain.Name
;
import
de.unikoblenz.ps.core.dmn.domain.vdmn.*
;
import
de.unikoblenz.ps.core.dmn.domain.vdmn.utils.VDmnFunctions
;
import
de.unikoblenz.ps.core.dmn.verification.result.VerificationResultEntryElement
;
import
de.unikoblenz.ps.core.dmn.verification.result.actions.Action
;
import
de.unikoblenz.ps.core.dmn.verification.result.actions.VerificationFix
;
import
de.unikoblenz.ps.core.dmn.verification.verifier.AbstractVerifier
;
import
de.unikoblenz.ps.core.dmn.verification.verifier.DmnVerifier
;
import
de.unikoblenz.ps.core.dmn.verification.verifier.classification.DrdModelingLevelVerification
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
de
.
unikoblenz
.
ps
.
base
.
domain
.
Name
.
NO_NAME
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
domain
.
vdmn
.
utils
.
VDmnFunctions
.*;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
VerificationResultEntry
.
VerificationClassification
.
ERROR
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
VerificationResultEntry
.
VerificationClassification
.
WARNING
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
Action
.
ACTION_SHOW_DECISION
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
Action
.
ACTION_SHOW_INPUT_DATA
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
ActionScope
.*;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
ActionType
.*;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
VerificationFix
.
DEFAULT_SHOW_NAME
;
import
static
de
.
unikoblenz
.
ps
.
core
.
dmn
.
verification
.
result
.
actions
.
VerificationFix
.
SHOW_INPUT_COLUMNS
;
@DmnVerifier
(
classification
=
DrdModelingLevelVerification
.
class
,
name
=
"CircularDRDVerifier"
,
niceName
=
"Circular DRD"
,
description
=
"Detecting circles in the DRD."
)
public
class
CircularDRDVerifier
extends
AbstractVerifier
{
@Override
protected
void
doVerification
()
{
Stack
<
VDmnDecision
>
history
=
new
Stack
<>();
Set
<
Set
<
VDmnDecision
>>
circles
=
new
HashSet
<>();
for
(
VDmnDecision
decision
:
dmnObjectContainer
.
getVDmnDefinition
().
getVDmnDecisions
())
{
history
.
push
(
decision
);
dfs
(
history
,
circles
);
history
.
pop
();
}
}
private
void
dfs
(
Stack
<
VDmnDecision
>
history
,
Set
<
Set
<
VDmnDecision
>>
circles
)
{
for
(
VDmnDecision
next
:
history
.
peek
().
getInformationProvidingDecisions
())
{
if
(
history
.
firstElement
().
equals
(
next
))
{
Set
<
VDmnDecision
>
circle
=
new
HashSet
<>(
history
);
if
(!
circles
.
contains
(
circle
))
{
// new circle
circles
.
add
(
circle
);
circle
.
forEach
(
vDmnDecision
->
vreFactory
.
addElement
(
VerificationResultEntryElement
.
create
(
vDmnDecision
)));
vreFactory
.
addVerificationFix
(
VerificationFix
.
getBuilder
()
.
withFixName
(
DEFAULT_SHOW_NAME
)
.
addAction
(
ACTION_SHOW_DECISION
)
.
build
());
vreFactory
.
addToEntry
(
ERROR
,
"Circle in Decision nodes detected."
);
}
}
else
{
history
.
push
(
next
);
dfs
(
history
,
circles
);
history
.
pop
();
}
}
}
}
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