{"action":"created","issue":{"url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/27","labels_url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/27/comments","events_url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/27/events","html_url":"https://github.com/Nava2/umple-issue-test/issues/27","id":102490998,"number":27,"title":"Ensure association position information is based on alphabetical order, not order of appearance in the umple model","user":{"login":"Nava2","id":302365,"avatar_url":"https://avatars.githubusercontent.com/u/302365?v=3","gravatar_id":"","url":"https://api.github.com/users/Nava2","html_url":"https://github.com/Nava2","followers_url":"https://api.github.com/users/Nava2/followers","following_url":"https://api.github.com/users/Nava2/following{/other_user}","gists_url":"https://api.github.com/users/Nava2/gists{/gist_id}","starred_url":"https://api.github.com/users/Nava2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nava2/subscriptions","organizations_url":"https://api.github.com/users/Nava2/orgs","repos_url":"https://api.github.com/users/Nava2/repos","events_url":"https://api.github.com/users/Nava2/events{/privacy}","received_events_url":"https://api.github.com/users/Nava2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/Component-UmpleOnline","name":"Component-UmpleOnline","color":"FFFFFF"},{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/layout","name":"layout","color":"FFFFFF"},{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/Priority-Medium","name":"Priority-Medium","color":"FFFFFF"},{"url":"https://api.github.com/repos/Nava2/umple-issue-test/labels/Usability","name":"Usability","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-22T00:52:36Z","updated_at":"2015-08-22T00:52:36Z","closed_at":null,"body":"_From [TimothyCLethbridge](https://code.google.com/u/TimothyCLethbridge/) on June 24, 2011 09:50:43_\n\nEnsure association position information is based on alphabetical order, not order of appearance in the umple model. This ensures that as associations and classes are moved around, you don't end up having errors appear in the positions.\r\n\r\nReported by Andrew Forward | July 20th, 2010 @ 10:04 PM\r\n\r\nclass B\r\n{\r\n  0..1 -- * A;\r\n}\r\n\r\nclass A\r\n{\r\n\r\n}\r\n\r\n\r\n\r\nclass B\r\n{\r\n  position 50 30 109 41;\r\n  position.association A__B 30,41 74,0;\r\n}\r\n\r\nclass A\r\n{\r\n  position 50 130 109 41;\r\n}\r\n\r\nThe position for A__B should be the opposite (74,0) refers to A and (30,41) refers to B.\r\n\r\nComments and changes to this ticket\r\n\r\n    Julie Filion\r\n    Julie Filion July 26th, 2010 @ 05:29 PM\r\n        → State changed from “new” to “open”\r\n\r\n    Does this mean that classOne of the association should no longer be the class in which the association is defined, but rather the class that is alphabetically smaller?\r\n    Andrew Forward\r\n    Andrew Forward July 26th, 2010 @ 05:40 PM\r\n\r\n    I think that makes the most semantic sense, that way the position is\r\n    unambiguos regardless of where the association is defined. Here is how I\r\n    think it should change:\r\n\r\n    classOne and classTwo stay as is for now (once we drop the\r\n    associationVariable, we will actually point to associationEndOne and\r\n    associationEndTwo.\r\n\r\n    Introduce some derived attributes (still don't exist yet, so must be written\r\n    by hand - example shown below) such as (feel free to rename):\r\n\r\n    classLeft and classRight (later renamed to associationEndLeft and\r\n    associationEndRight)\r\n\r\n\r\n    //TODO: replace with derived attributes / association\r\n    UmpleClass classLeft;\r\n\r\n    before getClassLeft {\r\n        // code to determine which name is smaller\r\n      }\r\n\r\n    Once the derived attribute / association is in place, the Umple code might\r\n    look like:\r\n\r\n\r\n    //TODO: replace with derived attributes / association\r\n    UmpleClass classLeft = { /* code to determine which name is smaller */ }\r\n\r\n    Julie Filion\r\n    Julie Filion July 26th, 2010 @ 06:11 PM\r\n\r\n    Thanks. Which class would the derived attribute be added to?\r\n    Andrew Forward\r\n    Andrew Forward July 26th, 2010 @ 06:17 PM\r\n\r\n    Same class as classOne and classTwo (don't have the code in front of my\r\n    right now - just going from memory - if this doesn't make sense, assign the\r\n    bug to me with the question and I will answer it and pass it back to you).\r\n    Julie Filion\r\n    Julie Filion July 26th, 2010 @ 07:02 PM\r\n        → Assigned user changed from “Julie Filion” to “Andrew Forward”\r\n\r\n    Sorry, I am being unclear.\r\n\r\n    ClassOne and classTwo are not attributes of any class - they are simply named this way in the json generator. When the UmpleParser finds an association token, it creates two AssociationEnd instances.\r\n\r\n    The first refers to the class in which is defined the association (if it is inline)\r\n    ie:\r\n    class A{ -- B;}\r\n\r\n    or the class on the left of the definition (if it is explicit)\r\n    ie. association{ A -- B; }\r\n\r\n    The AssociationEnds are then used to create a new Association and add it to the model.\r\n\r\n    Would it be reasonable to add an after filter to the Association constructor that would swap the left and right ends if they are not in the correct order?\r\n\r\n    There is a method setEnds in class Association - can this be used to reset the ends? I don't think I fully understand what this method is doing before it sets the ends.\r\n    Andrew Forward\r\n    Andrew Forward July 26th, 2010 @ 07:16 PM\r\n\r\n    Good analysis, but I would instead rely on lazily determining classOne,\r\n    classTwo - otherwise you run into issues where you change the role name, you\r\n    will also need to check if you need to change the ordering.\r\n\r\n    One thing to remember is that Umple is written in Umple, so it sometimes\r\n    lacks the newest umple features. So, this might be an opportunity to\r\n    refactor to use after filter.\r\n\r\n    I believe the setEnds is in place because when parsing the code you don't\r\n    always have both classes defined - so you need to hold on to the first\r\n    object until you encounter the second.\r\n\r\n    Image parsing\r\n\r\n    class X\r\n    {\r\n      0..1 -- 1 Y;\r\n    }\r\n\r\n    class Y {}\r\n\r\n    When you encounter the \"0..1\", you have yet to define Y, so you cannot\r\n    create the association yet. Only once the whole application is parsed can\r\n    you then setEnds.\n\n_Original issue: http://code.google.com/p/umple/issues/detail?id=77_"},"comment":{"url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/comments/133618753","html_url":"https://github.com/Nava2/umple-issue-test/issues/27#issuecomment-133618753","issue_url":"https://api.github.com/repos/Nava2/umple-issue-test/issues/27","id":133618753,"user":{"login":"Nava2","id":302365,"avatar_url":"https://avatars.githubusercontent.com/u/302365?v=3","gravatar_id":"","url":"https://api.github.com/users/Nava2","html_url":"https://github.com/Nava2","followers_url":"https://api.github.com/users/Nava2/followers","following_url":"https://api.github.com/users/Nava2/following{/other_user}","gists_url":"https://api.github.com/users/Nava2/gists{/gist_id}","starred_url":"https://api.github.com/users/Nava2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nava2/subscriptions","organizations_url":"https://api.github.com/users/Nava2/orgs","repos_url":"https://api.github.com/users/Nava2/repos","events_url":"https://api.github.com/users/Nava2/events{/privacy}","received_events_url":"https://api.github.com/users/Nava2/received_events","type":"User","site_admin":false},"created_at":"2015-08-22T00:52:36Z","updated_at":"2015-08-22T00:52:36Z","body":"_From [TimothyCLethbridge](https://code.google.com/u/TimothyCLethbridge/) on June 24, 2011 07:05:46_\n\n**Labels:** layout  \n"}}