{"action":"created","issue":{"url":"https://api.github.com/repos/umple/umple/issues/766","repository_url":"https://api.github.com/repos/umple/umple","labels_url":"https://api.github.com/repos/umple/umple/issues/766/labels{/name}","comments_url":"https://api.github.com/repos/umple/umple/issues/766/comments","events_url":"https://api.github.com/repos/umple/umple/issues/766/events","html_url":"https://github.com/umple/umple/issues/766","id":139720616,"number":766,"title":"inconsistency of calling of exit and entry in state machine self transitions","user":{"login":"vahdat-ab","id":3684908,"avatar_url":"https://avatars.githubusercontent.com/u/3684908?v=3","gravatar_id":"","url":"https://api.github.com/users/vahdat-ab","html_url":"https://github.com/vahdat-ab","followers_url":"https://api.github.com/users/vahdat-ab/followers","following_url":"https://api.github.com/users/vahdat-ab/following{/other_user}","gists_url":"https://api.github.com/users/vahdat-ab/gists{/gist_id}","starred_url":"https://api.github.com/users/vahdat-ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vahdat-ab/subscriptions","organizations_url":"https://api.github.com/users/vahdat-ab/orgs","repos_url":"https://api.github.com/users/vahdat-ab/repos","events_url":"https://api.github.com/users/vahdat-ab/events{/privacy}","received_events_url":"https://api.github.com/users/vahdat-ab/received_events","type":"User","site_admin":false},"labels":[{"id":252679260,"url":"https://api.github.com/repos/umple/umple/labels/bug","name":"bug","color":"fc2929","default":true},{"id":252700614,"url":"https://api.github.com/repos/umple/umple/labels/Diffic-VEasy","name":"Diffic-VEasy","color":"bfe5bf","default":false},{"id":252700642,"url":"https://api.github.com/repos/umple/umple/labels/Java","name":"Java","color":"ededed","default":false},{"id":252699935,"url":"https://api.github.com/repos/umple/umple/labels/Priority-High","name":"Priority-High","color":"eb6420","default":false},{"id":252700313,"url":"https://api.github.com/repos/umple/umple/labels/stateMachines","name":"stateMachines","color":"ededed","default":false},{"id":252700433,"url":"https://api.github.com/repos/umple/umple/labels/ucosp","name":"ucosp","color":"ededed","default":false}],"state":"open","locked":false,"assignee":{"login":"tlaport4","id":6517719,"avatar_url":"https://avatars.githubusercontent.com/u/6517719?v=3","gravatar_id":"","url":"https://api.github.com/users/tlaport4","html_url":"https://github.com/tlaport4","followers_url":"https://api.github.com/users/tlaport4/followers","following_url":"https://api.github.com/users/tlaport4/following{/other_user}","gists_url":"https://api.github.com/users/tlaport4/gists{/gist_id}","starred_url":"https://api.github.com/users/tlaport4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlaport4/subscriptions","organizations_url":"https://api.github.com/users/tlaport4/orgs","repos_url":"https://api.github.com/users/tlaport4/repos","events_url":"https://api.github.com/users/tlaport4/events{/privacy}","received_events_url":"https://api.github.com/users/tlaport4/received_events","type":"User","site_admin":false},"assignees":[{"login":"tlaport4","id":6517719,"avatar_url":"https://avatars.githubusercontent.com/u/6517719?v=3","gravatar_id":"","url":"https://api.github.com/users/tlaport4","html_url":"https://github.com/tlaport4","followers_url":"https://api.github.com/users/tlaport4/followers","following_url":"https://api.github.com/users/tlaport4/following{/other_user}","gists_url":"https://api.github.com/users/tlaport4/gists{/gist_id}","starred_url":"https://api.github.com/users/tlaport4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tlaport4/subscriptions","organizations_url":"https://api.github.com/users/tlaport4/orgs","repos_url":"https://api.github.com/users/tlaport4/repos","events_url":"https://api.github.com/users/tlaport4/events{/privacy}","received_events_url":"https://api.github.com/users/tlaport4/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2016-03-09T22:29:05Z","updated_at":"2016-12-16T20:17:18Z","closed_at":null,"body":"In the generated code for Umple state machines, `exit` and `entry` parts of states are dealt in different ways. We know that cyclic transitions can be `internal` or `external`. As long as I know, Umple consider the cyclic transitions as an `external` one. Therefore, it must run `entry` and `exit` parts for every cyclic transiton. However, In the generated code, we can see the `entry` part is executed, but the `exit` part doesn't. Let's have a look at an example:\n\n```\nclass A{\n  boolean result = false;\n  sm{\n    created{\n      exit /{execute_exit_code();}\n      entry /{execute_entry_code();}\n      init [b==false] -> created;\n      init [b==true] -> initialized;\n    }\n    initialized{\n      getback ->created;\n    }\n  } \n}\n```\n\nin the generated code, we have the following code for the event `init`:\n\n```\n  public boolean init()\n  {\n    boolean wasEventProcessed = false;\n\n    Sm aSm = sm;\n    switch (aSm)\n    {\n      case created:\n        if (b.equals(false))\n        {\n          setSm(Sm.created);\n          wasEventProcessed = true;\n          break;\n        }\n        if (b.equals(true))\n        {\n          exitSm();\n          setSm(Sm.initialized);\n          wasEventProcessed = true;\n          break;\n        }\n        break;\n      default:\n        // Other states do respond to this event\n    }\n\n    return wasEventProcessed;\n  }\n```\n\nAs we can see, the method `exitSm()` is not executed for the cyclic case. However, the method `execute_entry_code()` is executed always through the method `setSm`\n\n```\n  private void setSm(Sm aSm)\n  {\n    sm = aSm;\n\n    // entry actions and do activities\n    switch(sm)\n    {\n      case created:\n        // line 7 \"model.ump\"\n        execute_entry_code();\n        break;\n    }\n  }\n```\n"},"comment":{"url":"https://api.github.com/repos/umple/umple/issues/comments/267686343","html_url":"https://github.com/umple/umple/issues/766#issuecomment-267686343","issue_url":"https://api.github.com/repos/umple/umple/issues/766","id":267686343,"user":{"login":"vahdat-ab","id":3684908,"avatar_url":"https://avatars.githubusercontent.com/u/3684908?v=3","gravatar_id":"","url":"https://api.github.com/users/vahdat-ab","html_url":"https://github.com/vahdat-ab","followers_url":"https://api.github.com/users/vahdat-ab/followers","following_url":"https://api.github.com/users/vahdat-ab/following{/other_user}","gists_url":"https://api.github.com/users/vahdat-ab/gists{/gist_id}","starred_url":"https://api.github.com/users/vahdat-ab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vahdat-ab/subscriptions","organizations_url":"https://api.github.com/users/vahdat-ab/orgs","repos_url":"https://api.github.com/users/vahdat-ab/repos","events_url":"https://api.github.com/users/vahdat-ab/events{/privacy}","received_events_url":"https://api.github.com/users/vahdat-ab/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T20:17:18Z","updated_at":"2016-12-16T20:17:18Z","body":"You need to make sure the result satisfies the execution order specified in my last comment. e.g. if the event e12 is called then exit_m1_execute(); -> exit_s1_execute(); -> exit_on_execute(); must be executed.\r\n"}}
{"actor":{"display_login":"vahdat-ab"}}