GitHub PullRequestReviewCommentEvent at 2014-12-12 00:25:33
Repository: nscript
Actor: esseks
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/esseks/nscript/pulls/comments/21721353","id":21721353,"diff_hunk":"@@ -549,6 +554,74 @@ public String toTcl(NSWorld w, NSObject o, char sep) {\n             return (preamble + s + epilogue).trim();\n         }\n     }\n+    \n+    /**\n+     * Switches color chosen more than one time with one not selected\n+     * @param o\t\tNSObject to fix\n+     */\n+    private void fixColors(NSObject o){\n+    \t\n+        Map<String,Integer> colors = new HashMap<String,Integer>();\n+    \tcolors.put(\"black\",0);\n+    \tcolors.put(\"white\",0);\n+    \tcolors.put(\"red\",0);\n+    \tcolors.put(\"green\",0);\n+    \tcolors.put(\"blue\",0);\n+    \tcolors.put(\"yellow\",0);\n+    \tcolors.put(\"pink\",0);\n+    \tcolors.put(\"orange\",0);\n+    \tcolors.put(\"cyan\",0);\n+    \tcolors.put(\"magenta\",0);\n+    \t\n+    \tString key;\n+    \tfor(int i=0;i<o.getAttributeCount();i++){\n+    \t\ttry{\n+    \t\t\tkey = o.getAttribute(i);\n+\t    \t\tif(colors.containsKey(key)){\n+\t\t    \t\tthis.changeMapValue(colors, key, 1);\n+\t    \t\t}\n+    \t\t}catch(Exception e){}\n+    \t}\n+    \t\n+    \tfor(int i=o.getAttributeCount(); i>=0;i--){\n+    \t\ttry{\n+\t    \t\tkey = o.getAttribute(i);\n+\t    \t\tif( colors.get(key) > 1 ){\n+\t    \t\t\tthis.changeMapValue(colors, key, -1);\n+\t    \t\t\to.setAttribute(i,this.getUnusedColor(colors));\n+\t    \t\t}\n+    \t\t}catch(Exception e){}","path":"src/main/java/org/esseks/nscript/TclSnippet.java","position":68,"original_position":68,"commit_id":"ecc1773884147f523d8ab588a7d43e4cbcce0fea","original_commit_id":"ecc1773884147f523d8ab588a7d43e4cbcce0fea","user":{"login":"esseks","id":464720,"avatar_url":"https://avatars.githubusercontent.com/u/464720?v=3","gravatar_id":"","url":"https://api.github.com/users/esseks","html_url":"https://github.com/esseks","followers_url":"https://api.github.com/users/esseks/followers","following_url":"https://api.github.com/users/esseks/following{/other_user}","gists_url":"https://api.github.com/users/esseks/gists{/gist_id}","starred_url":"https://api.github.com/users/esseks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esseks/subscriptions","organizations_url":"https://api.github.com/users/esseks/orgs","repos_url":"https://api.github.com/users/esseks/repos","events_url":"https://api.github.com/users/esseks/events{/privacy}","received_events_url":"https://api.github.com/users/esseks/received_events","type":"User","site_admin":false},"body":"Never ever catch `Exception`. Be more specific and don't silent them. Log or print to stderr. Honestly I don't remember whether we have a logging setup, maybe I'll check.","created_at":"2014-12-12T00:25:33Z","updated_at":"2014-12-12T00:25:33Z","html_url":"https://github.com/esseks/nscript/pull/2#discussion_r21721353","pull_request_url":"https://api.github.com/repos/esseks/nscript/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/esseks/nscript/pulls/comments/21721353"},"html":{"href":"https://github.com/esseks/nscript/pull/2#discussion_r21721353"},"pull_request":{"href":"https://api.github.com/repos/esseks/nscript/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/esseks/nscript/pulls/2","id":25568210,"html_url":"https://github.com/esseks/nscript/pull/2","diff_url":"https://github.com/esseks/nscript/pull/2.diff","patch_url":"https://github.com/esseks/nscript/pull/2.patch","issue_url":"https://api.github.com/repos/esseks/nscript/issues/2","number":2,"state":"open","locked":false,"title":"Adding to the code","user":{"login":"luca-morreale","id":7807933,"avatar_url":"https://avatars.githubusercontent.com/u/7807933?v=3","gravatar_id":"","url":"https://api.github.com/users/luca-morreale","html_url":"https://github.com/luca-morreale","followers_url":"https://api.github.com/users/luca-morreale/followers","following_url":"https://api.github.com/users/luca-morreale/following{/other_user}","gists_url":"https://api.github.com/users/luca-morreale/gists{/gist_id}","starred_url":"https://api.github.com/users/luca-morreale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luca-morreale/subscriptions","organizations_url":"https://api.github.com/users/luca-morreale/orgs","repos_url":"https://api.github.com/users/luca-morreale/repos","events_url":"https://api.github.com/users/luca-morreale/events{/privacy}","received_events_url":"https://api.github.com/users/luca-morreale/received_events","type":"User","site_admin":false},"body":"Hello Stefano,\r\nI've changed some parts of your code:\r\n-I've added the ordering of NSObjects to generate the tcl script always in order, no matter what the order in which the user drags the components, the script will respect the order need by ns.\r\n-I've changed the behaviour of color entity, fixing his attributes in order to give to each color only one identifier, for example \"magenta\" cannot appear in Color0 and in Color10, the program will replace Color10 with the coloro unused.\r\n\r\nI hope you will like my changes.\r\nLuca.\r\n ","created_at":"2014-12-05T12:45:25Z","updated_at":"2014-12-12T00:25:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7431c8744798ab12cb0f5ce3ee975baf78c86f65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/esseks/nscript/pulls/2/commits","review_comments_url":"https://api.github.com/repos/esseks/nscript/pulls/2/comments","review_comment_url":"https://api.github.com/repos/esseks/nscript/pulls/comments/{number}","comments_url":"https://api.github.com/repos/esseks/nscript/issues/2/comments","statuses_url":"https://api.github.com/repos/esseks/nscript/statuses/ecc1773884147f523d8ab588a7d43e4cbcce0fea","head":{"label":"luca-morreale:master","ref":"master","sha":"ecc1773884147f523d8ab588a7d43e4cbcce0fea","user":{"login":"luca-morreale","id":7807933,"avatar_url":"https://avatars.githubusercontent.com/u/7807933?v=3","gravatar_id":"","url":"https://api.github.com/users/luca-morreale","html_url":"https://github.com/luca-morreale","followers_url":"https://api.github.com/users/luca-morreale/followers","following_url":"https://api.github.com/users/luca-morreale/following{/other_user}","gists_url":"https://api.github.com/users/luca-morreale/gists{/gist_id}","starred_url":"https://api.github.com/users/luca-morreale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luca-morreale/subscriptions","organizations_url":"https://api.github.com/users/luca-morreale/orgs","repos_url":"https://api.github.com/users/luca-morreale/repos","events_url":"https://api.github.com/users/luca-morreale/events{/privacy}","received_events_url":"https://api.github.com/users/luca-morreale/received_events","type":"User","site_admin":false},"repo":{"id":27503751,"name":"nscript","full_name":"luca-morreale/nscript","owner":{"login":"luca-morreale","id":7807933,"avatar_url":"https://avatars.githubusercontent.com/u/7807933?v=3","gravatar_id":"","url":"https://api.github.com/users/luca-morreale","html_url":"https://github.com/luca-morreale","followers_url":"https://api.github.com/users/luca-morreale/followers","following_url":"https://api.github.com/users/luca-morreale/following{/other_user}","gists_url":"https://api.github.com/users/luca-morreale/gists{/gist_id}","starred_url":"https://api.github.com/users/luca-morreale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luca-morreale/subscriptions","organizations_url":"https://api.github.com/users/luca-morreale/orgs","repos_url":"https://api.github.com/users/luca-morreale/repos","events_url":"https://api.github.com/users/luca-morreale/events{/privacy}","received_events_url":"https://api.github.com/users/luca-morreale/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/luca-morreale/nscript","description":"Advanced network visual editor for NS2 and NAM","fork":true,"url":"https://api.github.com/repos/luca-morreale/nscript","forks_url":"https://api.github.com/repos/luca-morreale/nscript/forks","keys_url":"https://api.github.com/repos/luca-morreale/nscript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/luca-morreale/nscript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/luca-morreale/nscript/teams","hooks_url":"https://api.github.com/repos/luca-morreale/nscript/hooks","issue_events_url":"https://api.github.com/repos/luca-morreale/nscript/issues/events{/number}","events_url":"https://api.github.com/repos/luca-morreale/nscript/events","assignees_url":"https://api.github.com/repos/luca-morreale/nscript/assignees{/user}","branches_url":"https://api.github.com/repos/luca-morreale/nscript/branches{/branch}","tags_url":"https://api.github.com/repos/luca-morreale/nscript/tags","blobs_url":"https://api.github.com/repos/luca-morreale/nscript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/luca-morreale/nscript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/luca-morreale/nscript/git/refs{/sha}","trees_url":"https://api.github.com/repos/luca-morreale/nscript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/luca-morreale/nscript/statuses/{sha}","languages_url":"https://api.github.com/repos/luca-morreale/nscript/languages","stargazers_url":"https://api.github.com/repos/luca-morreale/nscript/stargazers","contributors_url":"https://api.github.com/repos/luca-morreale/nscript/contributors","subscribers_url":"https://api.github.com/repos/luca-morreale/nscript/subscribers","subscription_url":"https://api.github.com/repos/luca-morreale/nscript/subscription","commits_url":"https://api.github.com/repos/luca-morreale/nscript/commits{/sha}","git_commits_url":"https://api.github.com/repos/luca-morreale/nscript/git/commits{/sha}","comments_url":"https://api.github.com/repos/luca-morreale/nscript/comments{/number}","issue_comment_url":"https://api.github.com/repos/luca-morreale/nscript/issues/comments/{number}","contents_url":"https://api.github.com/repos/luca-morreale/nscript/contents/{+path}","compare_url":"https://api.github.com/repos/luca-morreale/nscript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/luca-morreale/nscript/merges","archive_url":"https://api.github.com/repos/luca-morreale/nscript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/luca-morreale/nscript/downloads","issues_url":"https://api.github.com/repos/luca-morreale/nscript/issues{/number}","pulls_url":"https://api.github.com/repos/luca-morreale/nscript/pulls{/number}","milestones_url":"https://api.github.com/repos/luca-morreale/nscript/milestones{/number}","notifications_url":"https://api.github.com/repos/luca-morreale/nscript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/luca-morreale/nscript/labels{/name}","releases_url":"https://api.github.com/repos/luca-morreale/nscript/releases{/id}","created_at":"2014-12-03T19:28:24Z","updated_at":"2014-12-11T22:48:35Z","pushed_at":"2014-12-11T22:48:34Z","git_url":"git://github.com/luca-morreale/nscript.git","ssh_url":"git@github.com:luca-morreale/nscript.git","clone_url":"https://github.com/luca-morreale/nscript.git","svn_url":"https://github.com/luca-morreale/nscript","homepage":"","size":2786,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"esseks:master","ref":"master","sha":"994a3f01d3f4fd0033acc203262ae3408dbdf805","user":{"login":"esseks","id":464720,"avatar_url":"https://avatars.githubusercontent.com/u/464720?v=3","gravatar_id":"","url":"https://api.github.com/users/esseks","html_url":"https://github.com/esseks","followers_url":"https://api.github.com/users/esseks/followers","following_url":"https://api.github.com/users/esseks/following{/other_user}","gists_url":"https://api.github.com/users/esseks/gists{/gist_id}","starred_url":"https://api.github.com/users/esseks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esseks/subscriptions","organizations_url":"https://api.github.com/users/esseks/orgs","repos_url":"https://api.github.com/users/esseks/repos","events_url":"https://api.github.com/users/esseks/events{/privacy}","received_events_url":"https://api.github.com/users/esseks/received_events","type":"User","site_admin":false},"repo":{"id":6531200,"name":"nscript","full_name":"esseks/nscript","owner":{"login":"esseks","id":464720,"avatar_url":"https://avatars.githubusercontent.com/u/464720?v=3","gravatar_id":"","url":"https://api.github.com/users/esseks","html_url":"https://github.com/esseks","followers_url":"https://api.github.com/users/esseks/followers","following_url":"https://api.github.com/users/esseks/following{/other_user}","gists_url":"https://api.github.com/users/esseks/gists{/gist_id}","starred_url":"https://api.github.com/users/esseks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esseks/subscriptions","organizations_url":"https://api.github.com/users/esseks/orgs","repos_url":"https://api.github.com/users/esseks/repos","events_url":"https://api.github.com/users/esseks/events{/privacy}","received_events_url":"https://api.github.com/users/esseks/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/esseks/nscript","description":"Advanced network visual editor for NS2 and NAM","fork":false,"url":"https://api.github.com/repos/esseks/nscript","forks_url":"https://api.github.com/repos/esseks/nscript/forks","keys_url":"https://api.github.com/repos/esseks/nscript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/esseks/nscript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/esseks/nscript/teams","hooks_url":"https://api.github.com/repos/esseks/nscript/hooks","issue_events_url":"https://api.github.com/repos/esseks/nscript/issues/events{/number}","events_url":"https://api.github.com/repos/esseks/nscript/events","assignees_url":"https://api.github.com/repos/esseks/nscript/assignees{/user}","branches_url":"https://api.github.com/repos/esseks/nscript/branches{/branch}","tags_url":"https://api.github.com/repos/esseks/nscript/tags","blobs_url":"https://api.github.com/repos/esseks/nscript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/esseks/nscript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/esseks/nscript/git/refs{/sha}","trees_url":"https://api.github.com/repos/esseks/nscript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/esseks/nscript/statuses/{sha}","languages_url":"https://api.github.com/repos/esseks/nscript/languages","stargazers_url":"https://api.github.com/repos/esseks/nscript/stargazers","contributors_url":"https://api.github.com/repos/esseks/nscript/contributors","subscribers_url":"https://api.github.com/repos/esseks/nscript/subscribers","subscription_url":"https://api.github.com/repos/esseks/nscript/subscription","commits_url":"https://api.github.com/repos/esseks/nscript/commits{/sha}","git_commits_url":"https://api.github.com/repos/esseks/nscript/git/commits{/sha}","comments_url":"https://api.github.com/repos/esseks/nscript/comments{/number}","issue_comment_url":"https://api.github.com/repos/esseks/nscript/issues/comments/{number}","contents_url":"https://api.github.com/repos/esseks/nscript/contents/{+path}","compare_url":"https://api.github.com/repos/esseks/nscript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/esseks/nscript/merges","archive_url":"https://api.github.com/repos/esseks/nscript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/esseks/nscript/downloads","issues_url":"https://api.github.com/repos/esseks/nscript/issues{/number}","pulls_url":"https://api.github.com/repos/esseks/nscript/pulls{/number}","milestones_url":"https://api.github.com/repos/esseks/nscript/milestones{/number}","notifications_url":"https://api.github.com/repos/esseks/nscript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/esseks/nscript/labels{/name}","releases_url":"https://api.github.com/repos/esseks/nscript/releases{/id}","created_at":"2012-11-04T14:01:48Z","updated_at":"2014-10-13T16:34:09Z","pushed_at":"2013-11-13T08:56:34Z","git_url":"git://github.com/esseks/nscript.git","ssh_url":"git@github.com:esseks/nscript.git","clone_url":"https://github.com/esseks/nscript.git","svn_url":"https://github.com/esseks/nscript","homepage":"","size":2876,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/esseks/nscript/pulls/2"},"html":{"href":"https://github.com/esseks/nscript/pull/2"},"issue":{"href":"https://api.github.com/repos/esseks/nscript/issues/2"},"comments":{"href":"https://api.github.com/repos/esseks/nscript/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/esseks/nscript/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/esseks/nscript/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/esseks/nscript/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/esseks/nscript/statuses/ecc1773884147f523d8ab588a7d43e4cbcce0fea"}}}}