Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
fa8bd2fa
Commit
fa8bd2fa
authored
Jul 12, 2012
by
Florian Hölzl
Browse files
bugfix, YELLOW
refs 886
parent
f587bea4
Changes
4
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component/trunk/src/org/fortiss/af3/component/constraint/ComponentConstraintChecker.java
View file @
fa8bd2fa
...
...
@@ -18,6 +18,7 @@ $Id$
package
org.fortiss.af3.component.constraint
;
import
static
org
.
fortiss
.
af3
.
component
.
constraint
.
ConstraintMessage
.
createDuplicatePortViolation
;
import
static
org
.
fortiss
.
af3
.
component
.
constraint
.
ConstraintMessage
.
createIllegalNameViolation
;
import
static
org
.
fortiss
.
af3
.
component
.
constraint
.
ConstraintMessage
.
createInitialValueTypeMismatchViolation
;
import
static
org
.
fortiss
.
af3
.
component
.
constraint
.
ConstraintMessage
.
createUnknownTypeViolationWithSource
;
import
static
org
.
fortiss
.
af3
.
project
.
utils
.
TypeScopeUtils
.
getTypeDefinition
;
...
...
@@ -35,6 +36,7 @@ import org.fortiss.af3.expression.language.TypeSystemHandler;
import
org.fortiss.af3.expression.model.types.TDefinedType
;
import
org.fortiss.tooling.kernel.extension.base.MultiViolationConstraintCheckerBase
;
import
org.fortiss.tooling.kernel.extension.data.IConstraintViolation
;
import
org.fortiss.tooling.kernel.model.INamedElement
;
/**
* A constraint checker for {@link Component}s.
...
...
@@ -42,7 +44,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
58FE5ED0EDFB020D1AE7ACED26812627
* @ConQAT.Rating YELLOW Hash:
643E54666097B91792EAD23D8F4B60A6
*/
public
class
ComponentConstraintChecker
extends
MultiViolationConstraintCheckerBase
<
Component
,
Component
>
{
...
...
@@ -51,6 +53,7 @@ public class ComponentConstraintChecker extends
@Override
public
void
collectViolations
(
Component
modelElement
,
List
<
IConstraintViolation
<
Component
>>
results
)
{
performStartsWithNumberNameCheck
(
modelElement
,
results
);
Set
<
String
>
seenPorts
=
new
HashSet
<
String
>();
for
(
InputPort
p
:
modelElement
.
getInputPorts
())
{
performPortCheck
(
p
,
seenPorts
,
results
);
...
...
@@ -60,6 +63,19 @@ public class ComponentConstraintChecker extends
}
}
/** Checks if name starts with a number. */
private
void
performStartsWithNumberNameCheck
(
INamedElement
modelElement
,
List
<
IConstraintViolation
<
Component
>>
results
)
{
String
name
=
modelElement
.
getName
();
if
(
""
.
equals
(
name
)
||
"0123456789"
.
contains
(
""
+
name
.
charAt
(
0
)))
{
if
(
modelElement
instanceof
Component
)
{
results
.
add
(
createIllegalNameViolation
((
Component
)
modelElement
,
name
));
}
else
if
(
modelElement
instanceof
Port
)
{
results
.
add
(
createIllegalNameViolation
((
Port
)
modelElement
,
name
));
}
}
}
/** Checks duplicate port name, port type and initial value type. */
private
void
performPortCheck
(
Port
p
,
Set
<
String
>
seenPorts
,
List
<
IConstraintViolation
<
Component
>>
results
)
{
...
...
@@ -67,6 +83,7 @@ public class ComponentConstraintChecker extends
results
.
add
(
createDuplicatePortViolation
(
p
.
getComponent
(),
p
.
getName
()));
}
else
{
seenPorts
.
add
(
p
.
getName
());
performStartsWithNumberNameCheck
(
p
,
results
);
performTypeCheck
(
p
,
results
);
}
}
...
...
org.fortiss.af3.component/trunk/src/org/fortiss/af3/component/constraint/ConstraintMessage.java
View file @
fa8bd2fa
...
...
@@ -22,6 +22,7 @@ import static org.fortiss.tooling.kernel.extension.data.IConstraintViolation.ESe
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.af3.component.model.Channel
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.Port
;
import
org.fortiss.af3.component.model.behavior.code.CodeSpecification
;
import
org.fortiss.af3.component.model.behavior.common.Action
;
import
org.fortiss.af3.component.model.behavior.common.DataStateVariable
;
...
...
@@ -38,7 +39,7 @@ import org.fortiss.tooling.kernel.model.INamedElement;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash:
0840DABF166CB159AE3CBE15E0EB00E7
* @ConQAT.Rating YELLOW Hash:
B1ABD5FD9AA97E9A03764950E6480394
*/
final
class
ConstraintMessage
{
...
...
@@ -48,13 +49,26 @@ final class ConstraintMessage {
" is part of a weakly causal cylce"
);
}
/** Creates the violation for duplicate
enumeration
s. */
/** Creates the violation for duplicate
port
s. */
public
static
ConstraintViolationBase
<
Component
>
createDuplicatePortViolation
(
Component
c
,
String
name
)
{
return
new
ConstraintViolationBase
<
Component
>(
c
,
ERROR
,
"Duplicate port "
+
name
+
" in "
+
c
.
getName
());
}
/** Creates the violation for illegal component name. */
public
static
ConstraintViolationBase
<
Component
>
createIllegalNameViolation
(
Component
c
,
String
name
)
{
return
new
ConstraintViolationBase
<
Component
>(
c
,
ERROR
,
"Illegal component name "
+
name
);
}
/** Creates the violation for illegal component name. */
public
static
ConstraintViolationBase
<
Component
>
createIllegalNameViolation
(
Port
p
,
String
name
)
{
return
new
ConstraintViolationBase
<
Component
>(
p
.
getComponent
(),
ERROR
,
"Illegal port name "
+
name
+
" in component "
+
p
.
getComponent
().
getName
());
}
/** Creates violation for unknown type in component member. */
public
static
IConstraintViolation
<
Component
>
createUnknownTypeViolationWithSource
(
Component
c
,
String
source
,
String
name
)
{
...
...
org.fortiss.af3.state/trunk/src/org/fortiss/af3/state/constraint/ConstraintMessage.java
View file @
fa8bd2fa
...
...
@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
E0230BEE1B837DC56B4FFF39BD2D9524
* @ConQAT.Rating
YELLOW
Hash:
D55B5CB814ED2E5CC6408CF4FC68A492
*/
final
class
ConstraintMessage
{
...
...
org.fortiss.af3.state/trunk/src/org/fortiss/af3/state/constraint/StateAutomatonConstraintChecker.java
View file @
fa8bd2fa
...
...
@@ -40,7 +40,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
GREEN
Hash:
1A38A7724A407D43112A654831582B1F
* @ConQAT.Rating
YELLOW
Hash:
2712669752170D82A55D4EBB35425721
*/
public
class
StateAutomatonConstraintChecker
extends
ConstraintCheckerBase
<
StateAutomaton
>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment