E097 Enumeration and State Machine Conflict
Umple semantic error reported when an enumeration, and a state machine within the same class have the same name.
In Umple, enumerations and state machines within the same class cannot have the same name.
Example
-
-
-
-
- class X {
- enum Y { Red, Blue, Green }
- Y {
- s1 {
- goToS2 -> s2;
- }
- s2 { }
- }
- }
-
// This example generates the error
// because enumeration "Y" has the
// same name as state machine "Y"
class X {
enum Y { Red, Blue, Green }
Y {
s1 {
goToS2 -> s2;
}
s2 { }
}
}
Load the above code into UmpleOnline
Another Example
-
-
-
-
-
- enum Y { Red, Blue, Green }
-
- class X {
- showY(Y attr) {
- System.out.println(attr); }
- Y {
- s1 {}
- }
- }
-
// This example generates the error
// because enumeration "Y" will be
// added to class "X" since the "attr"
// parameter of "showY" is "Y".
enum Y { Red, Blue, Green }
class X {
showY(Y attr) {
System.out.println(attr); }
Y {
s1 {}
}
}
Load the above code into UmpleOnline
Solution to The Above So the Message No Longer Appears
-
-
- class X {
- enum Y { Red, Blue, Green }
- Z {
- s1 {
- goToS2 -> s2;
- }
- s2 { }
- }
- }
-
// This example does not generate the error
class X {
enum Y { Red, Blue, Green }
Z {
s1 {
goToS2 -> s2;
}
s2 { }
}
}
Load the above code into UmpleOnline
|