{"action":"created","comment":{"url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/comments/39721231","id":39721231,"diff_hunk":"@@ -0,0 +1,71 @@\n+\n+public class Functions {\n+\n+\tpublic Polynomial add(Polynomial a, Polynomial b) {\n+\t\tint deg = Math.max(a.getDegree(), b.getDegree());\n+\t\tdouble[] sum = new double[deg + 1];\n+\t\tdouble[] v1 = a.getPolynomial();\n+\t\tdouble[] v2 = b.getPolynomial();\n+\t\tfor (int i = 0; i < sum.length; i++) {\n+\t\t\tsum[i] = 0;\n+\t\t}\n+\t\tfor (int i = 0; i < v1.length; i++) {\n+\t\t\tsum[i] += v1[i];\n+\t\t}\n+\t\tfor (int i = 0; i < v2.length; i++) {\n+\t\t\tsum[i] += v2[i];\n+\t\t}\n+\t\treturn new Polynomial(sum);\n+\t}\n+\n+\tpublic Polynomial subtract(Polynomial a, Polynomial b) {\n+\t\tint deg = Math.max(a.getDegree(), b.getDegree());\n+\t\tdouble[] sub = new double[deg + 1];\n+\t\tfor (int i = 0; i <= deg; i++) {\n+\t\t\tsub[i] = 0;\n+\t\t}\n+\t\tdouble[] v1 = a.getPolynomial();\n+\t\tdouble[] v2 = b.getPolynomial();\n+\t\tfor (int i = 0; i < v1.length; i++) {\n+\t\t\tsub[i] = v1[i];\n+\t\t}\n+\t\tfor (int i = 0; i < v2.length; i++) {\n+\t\t\tsub[i] -= v2[i];\n+\t\t}\n+\t\treturn new Polynomial(sub);\n+\t}\n+\n+\tpublic Polynomial multiply(Polynomial a, Polynomial b) {\n+\t\tint deg = a.getDegree() + b.getDegree();\n+\t\tdouble[] mul = new double[deg + 1];\n+\t\tfor (int i = 0; i <= deg; i++) {\n+\t\t\tmul[i] = 0;\n+\t\t}\n+\t\tdouble[] v1 = a.getPolynomial();\n+\t\tdouble[] v2 = b.getPolynomial();\n+\t\tfor (int i = 0; i < v1.length; i++) {\n+\t\t\tfor (int j = 0; j < v2.length; j++) {\n+\t\t\t\tmul[i + j] += v1[i] * v2[j];\n+\t\t\t}\n+\t\t}\n+\t\treturn new Polynomial(mul);\n+\t}\n+\n+\tpublic Polynomial scalarMultiplication(Polynomial a, int nr) {\n+\t\tdouble[] v1 = a.getPolynomial();\n+\t\tfor (int i = 0; i < v1.length; i++) {\n+\t\t\tv1[i] *= nr;\n+\t\t}\n+\t\treturn new Polynomial(v1);","path":"Students/Ghiurutan V. Alexandru/Polynomial/src/Functions.java","position":59,"original_position":59,"commit_id":"b003834e3ba7535f3cce60cff63b328ca4b38d64","original_commit_id":"b003834e3ba7535f3cce60cff63b328ca4b38d64","user":{"login":"Alex-Cosma","id":5063160,"avatar_url":"https://avatars.githubusercontent.com/u/5063160?v=3","gravatar_id":"","url":"https://api.github.com/users/Alex-Cosma","html_url":"https://github.com/Alex-Cosma","followers_url":"https://api.github.com/users/Alex-Cosma/followers","following_url":"https://api.github.com/users/Alex-Cosma/following{/other_user}","gists_url":"https://api.github.com/users/Alex-Cosma/gists{/gist_id}","starred_url":"https://api.github.com/users/Alex-Cosma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alex-Cosma/subscriptions","organizations_url":"https://api.github.com/users/Alex-Cosma/orgs","repos_url":"https://api.github.com/users/Alex-Cosma/repos","events_url":"https://api.github.com/users/Alex-Cosma/events{/privacy}","received_events_url":"https://api.github.com/users/Alex-Cosma/received_events","type":"User","site_admin":false},"body":"Even though you are creating a new object here, you already modified the array from the previous polynomial.\r\n\r\nThe solution is to `deep clone` the array as to not modify the previous array but rather a new one.","created_at":"2015-09-17T08:25:27Z","updated_at":"2015-09-17T08:25:27Z","html_url":"https://github.com/JavaSummer/JavaMainRepo/pull/90#discussion_r39721231","pull_request_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90","_links":{"self":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/comments/39721231"},"html":{"href":"https://github.com/JavaSummer/JavaMainRepo/pull/90#discussion_r39721231"},"pull_request":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90"}}},"pull_request":{"url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90","id":42112669,"html_url":"https://github.com/JavaSummer/JavaMainRepo/pull/90","diff_url":"https://github.com/JavaSummer/JavaMainRepo/pull/90.diff","patch_url":"https://github.com/JavaSummer/JavaMainRepo/pull/90.patch","issue_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/90","number":90,"state":"closed","locked":false,"title":"Polynomial","user":{"login":"AlexandruGH","id":11159928,"avatar_url":"https://avatars.githubusercontent.com/u/11159928?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandruGH","html_url":"https://github.com/AlexandruGH","followers_url":"https://api.github.com/users/AlexandruGH/followers","following_url":"https://api.github.com/users/AlexandruGH/following{/other_user}","gists_url":"https://api.github.com/users/AlexandruGH/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandruGH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandruGH/subscriptions","organizations_url":"https://api.github.com/users/AlexandruGH/orgs","repos_url":"https://api.github.com/users/AlexandruGH/repos","events_url":"https://api.github.com/users/AlexandruGH/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandruGH/received_events","type":"User","site_admin":false},"body":"Hi! Sorry for posting that so late.\r\nI think I have some bad lines of code, because my program doesn't print anything.","created_at":"2015-08-11T10:10:27Z","updated_at":"2015-09-17T08:25:27Z","closed_at":"2015-09-17T07:44:20Z","merged_at":"2015-09-17T07:44:20Z","merge_commit_sha":"294f7f45f202b75380930d3384b13c8cddc9cda9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90/commits","review_comments_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90/comments","review_comment_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/90/comments","statuses_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/statuses/b003834e3ba7535f3cce60cff63b328ca4b38d64","head":{"label":"AlexandruGH:master","ref":"master","sha":"b003834e3ba7535f3cce60cff63b328ca4b38d64","user":{"login":"AlexandruGH","id":11159928,"avatar_url":"https://avatars.githubusercontent.com/u/11159928?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandruGH","html_url":"https://github.com/AlexandruGH","followers_url":"https://api.github.com/users/AlexandruGH/followers","following_url":"https://api.github.com/users/AlexandruGH/following{/other_user}","gists_url":"https://api.github.com/users/AlexandruGH/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandruGH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandruGH/subscriptions","organizations_url":"https://api.github.com/users/AlexandruGH/orgs","repos_url":"https://api.github.com/users/AlexandruGH/repos","events_url":"https://api.github.com/users/AlexandruGH/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandruGH/received_events","type":"User","site_admin":false},"repo":{"id":37848186,"name":"JavaMainRepo","full_name":"AlexandruGH/JavaMainRepo","owner":{"login":"AlexandruGH","id":11159928,"avatar_url":"https://avatars.githubusercontent.com/u/11159928?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexandruGH","html_url":"https://github.com/AlexandruGH","followers_url":"https://api.github.com/users/AlexandruGH/followers","following_url":"https://api.github.com/users/AlexandruGH/following{/other_user}","gists_url":"https://api.github.com/users/AlexandruGH/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexandruGH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexandruGH/subscriptions","organizations_url":"https://api.github.com/users/AlexandruGH/orgs","repos_url":"https://api.github.com/users/AlexandruGH/repos","events_url":"https://api.github.com/users/AlexandruGH/events{/privacy}","received_events_url":"https://api.github.com/users/AlexandruGH/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AlexandruGH/JavaMainRepo","description":"Main Repository for the summer Java course","fork":true,"url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo","forks_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/forks","keys_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/teams","hooks_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/hooks","issue_events_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/issues/events{/number}","events_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/events","assignees_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/assignees{/user}","branches_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/branches{/branch}","tags_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/tags","blobs_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/git/refs{/sha}","trees_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/statuses/{sha}","languages_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/languages","stargazers_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/stargazers","contributors_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/contributors","subscribers_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/subscribers","subscription_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/subscription","commits_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/commits{/sha}","git_commits_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/git/commits{/sha}","comments_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/comments{/number}","issue_comment_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/issues/comments{/number}","contents_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/contents/{+path}","compare_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/merges","archive_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/downloads","issues_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/issues{/number}","pulls_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/pulls{/number}","milestones_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/milestones{/number}","notifications_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/labels{/name}","releases_url":"https://api.github.com/repos/AlexandruGH/JavaMainRepo/releases{/id}","created_at":"2015-06-22T09:55:33Z","updated_at":"2015-07-15T20:23:28Z","pushed_at":"2015-09-16T08:40:33Z","git_url":"git://github.com/AlexandruGH/JavaMainRepo.git","ssh_url":"git@github.com:AlexandruGH/JavaMainRepo.git","clone_url":"https://github.com/AlexandruGH/JavaMainRepo.git","svn_url":"https://github.com/AlexandruGH/JavaMainRepo","homepage":null,"size":43153,"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":"JavaSummer:master","ref":"master","sha":"8644896521dfe5618708c1f9409b6e7f36f1442b","user":{"login":"JavaSummer","id":12752525,"avatar_url":"https://avatars.githubusercontent.com/u/12752525?v=3","gravatar_id":"","url":"https://api.github.com/users/JavaSummer","html_url":"https://github.com/JavaSummer","followers_url":"https://api.github.com/users/JavaSummer/followers","following_url":"https://api.github.com/users/JavaSummer/following{/other_user}","gists_url":"https://api.github.com/users/JavaSummer/gists{/gist_id}","starred_url":"https://api.github.com/users/JavaSummer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JavaSummer/subscriptions","organizations_url":"https://api.github.com/users/JavaSummer/orgs","repos_url":"https://api.github.com/users/JavaSummer/repos","events_url":"https://api.github.com/users/JavaSummer/events{/privacy}","received_events_url":"https://api.github.com/users/JavaSummer/received_events","type":"Organization","site_admin":false},"repo":{"id":36890845,"name":"JavaMainRepo","full_name":"JavaSummer/JavaMainRepo","owner":{"login":"JavaSummer","id":12752525,"avatar_url":"https://avatars.githubusercontent.com/u/12752525?v=3","gravatar_id":"","url":"https://api.github.com/users/JavaSummer","html_url":"https://github.com/JavaSummer","followers_url":"https://api.github.com/users/JavaSummer/followers","following_url":"https://api.github.com/users/JavaSummer/following{/other_user}","gists_url":"https://api.github.com/users/JavaSummer/gists{/gist_id}","starred_url":"https://api.github.com/users/JavaSummer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JavaSummer/subscriptions","organizations_url":"https://api.github.com/users/JavaSummer/orgs","repos_url":"https://api.github.com/users/JavaSummer/repos","events_url":"https://api.github.com/users/JavaSummer/events{/privacy}","received_events_url":"https://api.github.com/users/JavaSummer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JavaSummer/JavaMainRepo","description":"Main Repository for the summer Java course","fork":false,"url":"https://api.github.com/repos/JavaSummer/JavaMainRepo","forks_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/forks","keys_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/teams","hooks_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/hooks","issue_events_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/events{/number}","events_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/events","assignees_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/assignees{/user}","branches_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/branches{/branch}","tags_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/tags","blobs_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/git/refs{/sha}","trees_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/statuses/{sha}","languages_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/languages","stargazers_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/stargazers","contributors_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/contributors","subscribers_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/subscribers","subscription_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/subscription","commits_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/commits{/sha}","git_commits_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/git/commits{/sha}","comments_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/comments{/number}","issue_comment_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/comments{/number}","contents_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/contents/{+path}","compare_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/merges","archive_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/downloads","issues_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues{/number}","pulls_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls{/number}","milestones_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/milestones{/number}","notifications_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/labels{/name}","releases_url":"https://api.github.com/repos/JavaSummer/JavaMainRepo/releases{/id}","created_at":"2015-06-04T19:26:47Z","updated_at":"2015-09-16T11:57:15Z","pushed_at":"2015-09-17T07:44:20Z","git_url":"git://github.com/JavaSummer/JavaMainRepo.git","ssh_url":"git@github.com:JavaSummer/JavaMainRepo.git","clone_url":"https://github.com/JavaSummer/JavaMainRepo.git","svn_url":"https://github.com/JavaSummer/JavaMainRepo","homepage":null,"size":74191,"stargazers_count":15,"watchers_count":15,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":62,"mirror_url":null,"open_issues_count":2,"forks":62,"open_issues":2,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90"},"html":{"href":"https://github.com/JavaSummer/JavaMainRepo/pull/90"},"issue":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/90"},"comments":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/issues/90/comments"},"review_comments":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90/comments"},"review_comment":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/pulls/90/commits"},"statuses":{"href":"https://api.github.com/repos/JavaSummer/JavaMainRepo/statuses/b003834e3ba7535f3cce60cff63b328ca4b38d64"}}}}