Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
riseclipse-validator-scl2003
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RiseClipseGroup
riseclipse-validator-scl2003
Commits
e7bc8f1f
Commit
e7bc8f1f
authored
5 years ago
by
Dominique Marcadet
Browse files
Options
Downloads
Patches
Plain Diff
correct AtMostOne condition
parent
b419aba7
No related branches found
No related tags found
1 merge request
!11
Resolve "complete validation by NSD"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fr.centralesupelec.edf.riseclipse.iec61850.scl.tools/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/validator/nsd/PresenceConditionValidator.java
+17
-33
17 additions, 33 deletions
...ec61850/scl/validator/nsd/PresenceConditionValidator.java
with
17 additions
and
33 deletions
fr.centralesupelec.edf.riseclipse.iec61850.scl.tools/src/fr/centralesupelec/edf/riseclipse/iec61850/scl/validator/nsd/PresenceConditionValidator.java
+
17
−
33
View file @
e7bc8f1f
...
...
@@ -63,7 +63,7 @@ public class PresenceConditionValidator {
private
HashSet
<
String
>
mandatoryMulti
;
private
HashSet
<
String
>
optionalMulti
;
private
HashMap
<
Integer
,
HashSet
<
String
>
>
atLeastOne
;
private
HashMap
<
Integer
,
HashSet
<
String
>
>
atMostOne
;
private
HashSet
<
String
>
atMostOne
;
private
HashMap
<
Integer
,
HashSet
<
String
>
>
allOrNonePerGroup
;
private
HashMap
<
Integer
,
HashSet
<
String
>
>
allOnlyOneGroup
;
private
HashMap
<
Integer
,
HashSet
<
String
>
>
allAtLeastOneGroup
;
...
...
@@ -183,23 +183,9 @@ public class PresenceConditionValidator {
}
case
"AtMostOne"
:
// At most one of marked elements shall be present
if
(
atMostOne
==
null
)
atMostOne
=
new
HashMap
<>();
try
{
Integer
arg
=
Integer
.
valueOf
(
presCondArgs
);
if
(
arg
<=
0
)
{
console
.
warning
(
"NSD: argument of PresenceCondition \"AtMostOne\" is not a positive integer"
);
break
;
}
if
(
!
atMostOne
.
containsKey
(
arg
))
{
atMostOne
.
put
(
arg
,
new
HashSet
<>()
);
}
atMostOne
.
get
(
arg
).
add
(
name
);
break
;
}
catch
(
NumberFormatException
e
)
{
console
.
warning
(
"NSD: argument of PresenceCondition \"AtMostOne\" is not an integer"
);
break
;
}
if
(
atMostOne
==
null
)
atMostOne
=
new
HashSet
<>();
atMostOne
.
add
(
name
);
break
;
case
"AllOrNonePerGroup"
:
// Parameter n: group number (> 0).
// All or none of the elements of a group n shall be present
...
...
@@ -794,23 +780,21 @@ public class PresenceConditionValidator {
// At most one of marked elements shall be present
// Usage in standard NSD files (version 2007B): DataObject
if
(
atMostOne
!=
null
)
{
for
(
Entry
<
Integer
,
HashSet
<
String
>
>
e1
:
atMostOne
.
entrySet
()
)
{
int
groupCount
=
0
;
for
(
String
member
:
e1
.
getValue
()
)
{
if
(
presentDO
.
get
(
member
)
!=
null
)
{
++
groupCount
;
}
}
if
(
groupCount
>
1
)
{
diagnostics
.
add
(
new
BasicDiagnostic
(
Diagnostic
.
ERROR
,
RiseClipseValidatorSCL
.
DIAGNOSTIC_SOURCE
,
0
,
"[NSD] group "
+
e1
.
getKey
()
+
" has more than one element in LNodeType (line "
+
lNodeType
.
getLineNumber
()
+
") with LNClass "
+
anyLNClassName
,
new
Object
[]
{
lNodeType
}
));
res
=
false
;
int
count
=
0
;
for
(
String
s
:
atMostOne
)
{
if
(
presentDO
.
get
(
s
)
!=
null
)
{
++
count
;
}
}
if
(
count
>
1
)
{
diagnostics
.
add
(
new
BasicDiagnostic
(
Diagnostic
.
ERROR
,
RiseClipseValidatorSCL
.
DIAGNOSTIC_SOURCE
,
0
,
"[NSD] LNodeType (line "
+
lNodeType
.
getLineNumber
()
+
") with LNClass "
+
anyLNClassName
+
" has more than one element marked AtMostOne"
,
new
Object
[]
{
lNodeType
}
));
res
=
false
;
}
}
// presCond: "AllOrNonePerGroup" :
...
...
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