New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove generated "enter" methods from state machine code #1019

Closed
jblang94 opened this Issue Mar 19, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@jblang94
Contributor

jblang94 commented Mar 19, 2017

Brief Description

Currently for state machines, Umple produces unnecessary "enter" methods for states that contain nested state machines. The purpose of the enter methods is taken care of by the "set[StateMachineName]" methods, and the enter methods are not called anywhere in the generated code.

Minimum Steps to Reproduce

Consider the following example:


class X{
  sm{
    on{
      entry/{on_entry_action();}
      e1-> off;
      s1{
        entry/{s1_entry_action();}
        e2-> s2;
        e3-> on;
        m1{
          entry/{m1_entry_action();}
          e4-> m2;
          e5-> s1;
        } 
        m2{} 
      }
      s2{}
    }
    off{
      s3{
        e6-> s4;
      }
      s4{}
    }
  }
}

Expected Result

No generated enter methods.

Actual Result

private boolean enterOn()
{
  boolean wasEventProcessed = false;

  SmOn aSmOn = smOn;
  SmOnS1 aSmOnS1 = smOnS1;
  switch (aSmOn)
  {
    case Null:
      setSmOn(SmOn.s1);
      wasEventProcessed = true;
      break;
    default:
      // Other states do respond to this event
  }

  switch (aSmOnS1)
  {
    case Null:
      setSmOnS1(SmOnS1.m1);
      wasEventProcessed = true;
      break;
    default:
      // Other states do respond to this event
  }

  return wasEventProcessed;
}


private boolean enterOff()
{
  boolean wasEventProcessed = false;

  SmOff aSmOff = smOff;
  switch (aSmOff)
  {
    case Null:
      setSmOff(SmOff.s3);
      wasEventProcessed = true;
      break;
    default:
      // Other states do respond to this event
  }

  return wasEventProcessed;
}

Labelling

Given a "Diffic-Med" label because many existing state machine tests will need to be updated as a result of this fix.

@jblang94 jblang94 self-assigned this Mar 19, 2017

@jblang94 jblang94 changed the title from Remove generated "enter" method from state machine code to Remove generated "enter" methods from state machine code Mar 19, 2017

@vahdat-ab vahdat-ab closed this Mar 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment