list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

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

// 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

// 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

// 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