{"action":"created","issue":{"url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/305","repository_url":"https://api.github.com/repos/ELTE-Soft/txtUML","labels_url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/305/comments","events_url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/305/events","html_url":"https://github.com/ELTE-Soft/txtUML/issues/305","id":141298287,"number":305,"title":"Change request about the export of if-then-else","user":{"login":"devaigergely81","id":7555116,"avatar_url":"https://avatars.githubusercontent.com/u/7555116?v=3","gravatar_id":"","url":"https://api.github.com/users/devaigergely81","html_url":"https://github.com/devaigergely81","followers_url":"https://api.github.com/users/devaigergely81/followers","following_url":"https://api.github.com/users/devaigergely81/following{/other_user}","gists_url":"https://api.github.com/users/devaigergely81/gists{/gist_id}","starred_url":"https://api.github.com/users/devaigergely81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devaigergely81/subscriptions","organizations_url":"https://api.github.com/users/devaigergely81/orgs","repos_url":"https://api.github.com/users/devaigergely81/repos","events_url":"https://api.github.com/users/devaigergely81/events{/privacy}","received_events_url":"https://api.github.com/users/devaigergely81/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ELTE-Soft/txtUML/labels/category:model-export","name":"category:model-export","color":"fef2c0"},{"url":"https://api.github.com/repos/ELTE-Soft/txtUML/labels/prio:high","name":"prio:high","color":"e11d21"},{"url":"https://api.github.com/repos/ELTE-Soft/txtUML/labels/type:enhancement","name":"type:enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"nboldi","id":2959869,"avatar_url":"https://avatars.githubusercontent.com/u/2959869?v=3","gravatar_id":"","url":"https://api.github.com/users/nboldi","html_url":"https://github.com/nboldi","followers_url":"https://api.github.com/users/nboldi/followers","following_url":"https://api.github.com/users/nboldi/following{/other_user}","gists_url":"https://api.github.com/users/nboldi/gists{/gist_id}","starred_url":"https://api.github.com/users/nboldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nboldi/subscriptions","organizations_url":"https://api.github.com/users/nboldi/orgs","repos_url":"https://api.github.com/users/nboldi/repos","events_url":"https://api.github.com/users/nboldi/events{/privacy}","received_events_url":"https://api.github.com/users/nboldi/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-03-16T14:53:25Z","updated_at":"2016-03-23T10:16:44Z","closed_at":null,"body":"~~~~\r\nclass A {\r\n\tvoid f() {\r\n\t\tint i;\r\n\t\tif(i == 0) {\r\n\t\t\ti = 2;\r\n\t\t} else {\r\n\t\t\ti = 4;\r\n\t\t}\r\n\t}\r\n}\r\n~~~~\r\n![ifproblem](https://cloud.githubusercontent.com/assets/7555116/13815981/f119889e-eb8c-11e5-86c6-e8fc13f883ff.png)\r\n\r\nAn if-then-else is exported as a conditional node with two clauses. Each clause has a *test*, which is responsible for evaluating the condition of the clause and a decider (an output pin) that specifies the result of the computation. Since we want to avoid duplicate condition evaluations, the test of the then clause writes the result into a variable, which is then negated in the test of the else clause.\r\n\r\nThis causes data dependency between the two tests, which is represented by the object flow highlighted in the picture above. When determining the correct order in which the tests should be generated into the C++ code, this data dependency needs to be analysed. As a general design decision, we want the exported models to be explicitly structured, so that such data dependency analysis is never required. (That might be later extension.)\r\n\r\nSuggestion: Use one single test for all clauses, that creates one boolean local variable per clause, writes them (to set the values) and reads them (to provide output pins for the deciders).\r\n\r\nAnother request: the names of these variables should be Java/C++ identifiers, the # symbol currently causes problems.\r\n\r\nIn case an if- else if - else if - .... - else structure, currently multiple conditional nodes are generated embedded in each other. It would be nicer to have one single conditional node with many clauses. But this is not a blocking issue."},"comment":{"url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/comments/200282739","html_url":"https://github.com/ELTE-Soft/txtUML/issues/305#issuecomment-200282739","issue_url":"https://api.github.com/repos/ELTE-Soft/txtUML/issues/305","id":200282739,"user":{"login":"nagyandras95","id":15140899,"avatar_url":"https://avatars.githubusercontent.com/u/15140899?v=3","gravatar_id":"","url":"https://api.github.com/users/nagyandras95","html_url":"https://github.com/nagyandras95","followers_url":"https://api.github.com/users/nagyandras95/followers","following_url":"https://api.github.com/users/nagyandras95/following{/other_user}","gists_url":"https://api.github.com/users/nagyandras95/gists{/gist_id}","starred_url":"https://api.github.com/users/nagyandras95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagyandras95/subscriptions","organizations_url":"https://api.github.com/users/nagyandras95/orgs","repos_url":"https://api.github.com/users/nagyandras95/repos","events_url":"https://api.github.com/users/nagyandras95/events{/privacy}","received_events_url":"https://api.github.com/users/nagyandras95/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T10:16:44Z","updated_at":"2016-03-23T10:16:44Z","body":"I think this solution would be appropriate for if - else if .. statements. It was our notation with @devaigergely81 too."}}