{"action":"created","comment":{"url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments/43500215","id":43500215,"diff_hunk":"@@ -0,0 +1,155 @@\n+import structs/List\n+\n+LinkedList: class <T> {\n+\t_size = 0 : SizeT\n+\tsize ::= _size as Int\n+\thead: Node<T>\n+\tinit: func {\n+\t\thead = Node<T> new()\n+\t\thead prev = head\n+\t\thead next = head\n+\t}\n+\tadd: func (data: T) {\n+\t\tnode := Node<T> new(head prev, head, data)\n+\t\thead prev next = node\n+\t\thead prev = node\n+\t\t_size += 1\n+\t}\n+\tadd: func ~withIndex (index: SSizeT, data: T) {\n+\t\tif (index > 0 && index < this size) {\n+\t\t\tprevNode := getNode(index - 1)\n+\t\t\tnextNode := prevNode next\n+\t\t\tnode := Node<T> new(prevNode, nextNode, data)\n+\t\t\tprevNode next = node\n+\t\t\tnextNode prev = node\n+\t\t\t_size += 1\n+\t\t} else if (index > 0 && index == _size) {\n+\t\t\tadd(data)\n+\t\t} else if (index == 0) {\n+\t\t\tnode := Node<T> new(head, head next, data)\n+\t\t\thead next prev = node\n+\t\t\thead next = node\n+\t\t\t_size += 1\n+\t\t} else\n+\t\t\traise(\"Index out of bounds in LinkedList add~withIndex\")\n+\t}\n+\tget: func (index: SSizeT) -> T {\n+\t\tgetNode(index) data\n+\t}\n+\tgetNode: func (index: SSizeT) -> Node<T> {\n+\t\tif (index < 0 || index >= _size)\n+\t\t\traise(\"Index out of bounds in LinkedList getNode\")\n+\t\ti := 0\n+\t\tcurrent := head next\n+\t\twhile (current next != head && i < index) {\n+\t\t\tcurrent = current next\n+\t\t\ti += 1\n+\t\t}\n+\t\tcurrent\n+\t}\n+\tclear: func {\n+\t\thead next = head\n+\t\thead prev = head\n+\t\t_size = 0\n+\t}\n+\tindexOf: func (data: T) -> SSizeT {\n+\t\tcurrent := head next\n+\t\ti := 0\n+\t\tindex := -1\n+\t\twhile (current != head) {\n+\t\t\tif (memcmp(current data, data, T size) == 0) {\n+\t\t\t\tindex = i\n+\t\t\t\tbreak\n+\t\t\t}\n+\t\t\ti += 1\n+\t\t\tcurrent = current next\n+\t\t}\n+\t\tindex\n+\t}\n+\tlastIndexOf: func (data: T) -> SSizeT {\n+\t\tcurrent := head prev\n+\t\ti := _size - 1\n+\t\tindex := -1\n+\t\twhile (current != head) {\n+\t\t\tif (memcmp(current data, data, T size) == 0) {\n+\t\t\t\tindex = i\n+\t\t\t\tbreak\n+\t\t\t}\n+\t\t\ti -= 1\n+\t\t\tcurrent = current prev\n+\t\t}\n+\t\tindex\n+\t}\n+\tfirst: func -> T {\n+\t\tif (head next != head)\n+\t\t\treturn head next data\n+\t\telse\n+\t\t\treturn null\n+\t}\n+\tlast: func -> T {\n+\t\tif (head prev != head)\n+\t\t\treturn head prev data\n+\t\telse\n+\t\t\treturn null\n+\t}\n+\tremoveAt: func (index: SSizeT) -> T {\n+\t\titem := null\n+\t\tif (head next != head && 0 <= index && index < _size) {\n+\t\t\ttoRemove := getNode(index)\n+\t\t\tremoveNode(toRemove)\n+\t\t\titem = toRemove data\n+\t\t} else\n+\t\t\traise(\"Index out of bounds in LinkedList removeAt\")\n+\t\titem\n+\t}\n+\tremove: func (data: T) -> Bool {\n+\t\tresult := false\n+\t\ti := indexOf(data)\n+\t\tif (i != -1) {\n+\t\t\tremoveAt(i)\n+\t\t\tresult = true\n+\t\t}\n+\t\tresult\n+\t}\n+\tremoveNode: func (toRemove: Node<T>) {\n+\t\ttoRemove prev next = toRemove next\n+\t\ttoRemove next prev = toRemove prev\n+\t\ttoRemove prev = null\n+\t\ttoRemove next = null\n+\t\t_size -= 1\n+\t}\n+\tremoveLast: func -> Bool {\n+\t\tresult := false\n+\t\tif (head prev != head) {\n+\t\t\tremoveNode(head prev)\n+\t\t\tresult = true\n+\t\t}\n+\t\tresult\n+\t}\n+\tset: func (index: SSizeT, data: T) -> T {\n+\t\tnode := getNode(index)\n+\t\tret := node data\n+\t\tnode data = data\n+\t\tret\n+\t}\n+\tcopy: func -> This<T> {\n+\t\tother := This<T> new()\n+\t\tfor (i in 0 .. this size)\n+\t\t\tother add(this get(i))\n+\t\tother\n+\t}\n+}\n+\n+operator [] <T>(list: LinkedList<T>, index: Int) -> T { list get(index) }\n+operator []= <T>(list: LinkedList<T>, index: Int, value: T) { list set(index, value) }\n+\n+Node: class <T> {\n+\tprev: This<T>\n+\tnext: This<T>\n+\tdata: T\n+\tinit: func\n+\tinit: func ~withParams (=prev, =next, =data)\n+\t__destroy__: func {\n+\t\tgc_free(data)\n+\t}","path":"source/collections/LinkedList.ooc","position":154,"original_position":154,"commit_id":"255d507c8c99bedb97ac8c49b37787a79a3adff0","original_commit_id":"255d507c8c99bedb97ac8c49b37787a79a3adff0","user":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"body":"Oh, right. Also, `LinkedList` doesn't have a `free` at all.","created_at":"2015-10-30T13:15:00Z","updated_at":"2015-10-30T13:15:00Z","html_url":"https://github.com/cogneco/ooc-kean/pull/645#discussion_r43500215","pull_request_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645","_links":{"self":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments/43500215"},"html":{"href":"https://github.com/cogneco/ooc-kean/pull/645#discussion_r43500215"},"pull_request":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645"}}},"pull_request":{"url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645","id":49252556,"html_url":"https://github.com/cogneco/ooc-kean/pull/645","diff_url":"https://github.com/cogneco/ooc-kean/pull/645.diff","patch_url":"https://github.com/cogneco/ooc-kean/pull/645.patch","issue_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/645","number":645,"state":"open","locked":false,"title":"Moved out LinkedList from sdk","user":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"body":"Cleaned it up to make magic happy and added a simple test.\r\n","created_at":"2015-10-30T10:26:04Z","updated_at":"2015-10-30T13:15:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93740b074ac73a0f9b44745095a5711cd2ad7682","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645/commits","review_comments_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645/comments","review_comment_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/645/comments","statuses_url":"https://api.github.com/repos/cogneco/ooc-kean/statuses/255d507c8c99bedb97ac8c49b37787a79a3adff0","head":{"label":"marcusnaslund:linkedlist-move","ref":"linkedlist-move","sha":"255d507c8c99bedb97ac8c49b37787a79a3adff0","user":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"repo":{"id":42990201,"name":"ooc-kean","full_name":"marcusnaslund/ooc-kean","owner":{"login":"marcusnaslund","id":14308896,"avatar_url":"https://avatars.githubusercontent.com/u/14308896?v=3","gravatar_id":"","url":"https://api.github.com/users/marcusnaslund","html_url":"https://github.com/marcusnaslund","followers_url":"https://api.github.com/users/marcusnaslund/followers","following_url":"https://api.github.com/users/marcusnaslund/following{/other_user}","gists_url":"https://api.github.com/users/marcusnaslund/gists{/gist_id}","starred_url":"https://api.github.com/users/marcusnaslund/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcusnaslund/subscriptions","organizations_url":"https://api.github.com/users/marcusnaslund/orgs","repos_url":"https://api.github.com/users/marcusnaslund/repos","events_url":"https://api.github.com/users/marcusnaslund/events{/privacy}","received_events_url":"https://api.github.com/users/marcusnaslund/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marcusnaslund/ooc-kean","description":"ooc port of parts of Kean.","fork":true,"url":"https://api.github.com/repos/marcusnaslund/ooc-kean","forks_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/forks","keys_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/teams","hooks_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/hooks","issue_events_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues/events{/number}","events_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/events","assignees_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/assignees{/user}","branches_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/branches{/branch}","tags_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/tags","blobs_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/refs{/sha}","trees_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/statuses/{sha}","languages_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/languages","stargazers_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/stargazers","contributors_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/contributors","subscribers_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/subscribers","subscription_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/subscription","commits_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/commits{/sha}","git_commits_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/git/commits{/sha}","comments_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/comments{/number}","issue_comment_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues/comments{/number}","contents_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/contents/{+path}","compare_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/merges","archive_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/downloads","issues_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/issues{/number}","pulls_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/pulls{/number}","milestones_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/milestones{/number}","notifications_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/labels{/name}","releases_url":"https://api.github.com/repos/marcusnaslund/ooc-kean/releases{/id}","created_at":"2015-09-23T09:03:37Z","updated_at":"2015-09-23T09:03:39Z","pushed_at":"2015-10-30T13:02:34Z","git_url":"git://github.com/marcusnaslund/ooc-kean.git","ssh_url":"git@github.com:marcusnaslund/ooc-kean.git","clone_url":"https://github.com/marcusnaslund/ooc-kean.git","svn_url":"https://github.com/marcusnaslund/ooc-kean","homepage":"","size":27715,"stargazers_count":0,"watchers_count":0,"language":"ooc","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":"cogneco:master","ref":"master","sha":"171c5d7dd3fc4c8d2a50cc09808431eefa41c678","user":{"login":"cogneco","id":3601419,"avatar_url":"https://avatars.githubusercontent.com/u/3601419?v=3","gravatar_id":"","url":"https://api.github.com/users/cogneco","html_url":"https://github.com/cogneco","followers_url":"https://api.github.com/users/cogneco/followers","following_url":"https://api.github.com/users/cogneco/following{/other_user}","gists_url":"https://api.github.com/users/cogneco/gists{/gist_id}","starred_url":"https://api.github.com/users/cogneco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogneco/subscriptions","organizations_url":"https://api.github.com/users/cogneco/orgs","repos_url":"https://api.github.com/users/cogneco/repos","events_url":"https://api.github.com/users/cogneco/events{/privacy}","received_events_url":"https://api.github.com/users/cogneco/received_events","type":"Organization","site_admin":false},"repo":{"id":25256330,"name":"ooc-kean","full_name":"cogneco/ooc-kean","owner":{"login":"cogneco","id":3601419,"avatar_url":"https://avatars.githubusercontent.com/u/3601419?v=3","gravatar_id":"","url":"https://api.github.com/users/cogneco","html_url":"https://github.com/cogneco","followers_url":"https://api.github.com/users/cogneco/followers","following_url":"https://api.github.com/users/cogneco/following{/other_user}","gists_url":"https://api.github.com/users/cogneco/gists{/gist_id}","starred_url":"https://api.github.com/users/cogneco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogneco/subscriptions","organizations_url":"https://api.github.com/users/cogneco/orgs","repos_url":"https://api.github.com/users/cogneco/repos","events_url":"https://api.github.com/users/cogneco/events{/privacy}","received_events_url":"https://api.github.com/users/cogneco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cogneco/ooc-kean","description":"ooc port of parts of Kean.","fork":false,"url":"https://api.github.com/repos/cogneco/ooc-kean","forks_url":"https://api.github.com/repos/cogneco/ooc-kean/forks","keys_url":"https://api.github.com/repos/cogneco/ooc-kean/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cogneco/ooc-kean/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cogneco/ooc-kean/teams","hooks_url":"https://api.github.com/repos/cogneco/ooc-kean/hooks","issue_events_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/events{/number}","events_url":"https://api.github.com/repos/cogneco/ooc-kean/events","assignees_url":"https://api.github.com/repos/cogneco/ooc-kean/assignees{/user}","branches_url":"https://api.github.com/repos/cogneco/ooc-kean/branches{/branch}","tags_url":"https://api.github.com/repos/cogneco/ooc-kean/tags","blobs_url":"https://api.github.com/repos/cogneco/ooc-kean/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cogneco/ooc-kean/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cogneco/ooc-kean/git/refs{/sha}","trees_url":"https://api.github.com/repos/cogneco/ooc-kean/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cogneco/ooc-kean/statuses/{sha}","languages_url":"https://api.github.com/repos/cogneco/ooc-kean/languages","stargazers_url":"https://api.github.com/repos/cogneco/ooc-kean/stargazers","contributors_url":"https://api.github.com/repos/cogneco/ooc-kean/contributors","subscribers_url":"https://api.github.com/repos/cogneco/ooc-kean/subscribers","subscription_url":"https://api.github.com/repos/cogneco/ooc-kean/subscription","commits_url":"https://api.github.com/repos/cogneco/ooc-kean/commits{/sha}","git_commits_url":"https://api.github.com/repos/cogneco/ooc-kean/git/commits{/sha}","comments_url":"https://api.github.com/repos/cogneco/ooc-kean/comments{/number}","issue_comment_url":"https://api.github.com/repos/cogneco/ooc-kean/issues/comments{/number}","contents_url":"https://api.github.com/repos/cogneco/ooc-kean/contents/{+path}","compare_url":"https://api.github.com/repos/cogneco/ooc-kean/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cogneco/ooc-kean/merges","archive_url":"https://api.github.com/repos/cogneco/ooc-kean/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cogneco/ooc-kean/downloads","issues_url":"https://api.github.com/repos/cogneco/ooc-kean/issues{/number}","pulls_url":"https://api.github.com/repos/cogneco/ooc-kean/pulls{/number}","milestones_url":"https://api.github.com/repos/cogneco/ooc-kean/milestones{/number}","notifications_url":"https://api.github.com/repos/cogneco/ooc-kean/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cogneco/ooc-kean/labels{/name}","releases_url":"https://api.github.com/repos/cogneco/ooc-kean/releases{/id}","created_at":"2014-10-15T13:42:17Z","updated_at":"2015-05-08T13:13:16Z","pushed_at":"2015-10-30T13:04:04Z","git_url":"git://github.com/cogneco/ooc-kean.git","ssh_url":"git@github.com:cogneco/ooc-kean.git","clone_url":"https://github.com/cogneco/ooc-kean.git","svn_url":"https://github.com/cogneco/ooc-kean","homepage":"","size":31515,"stargazers_count":3,"watchers_count":3,"language":"ooc","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":58,"forks":16,"open_issues":58,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645"},"html":{"href":"https://github.com/cogneco/ooc-kean/pull/645"},"issue":{"href":"https://api.github.com/repos/cogneco/ooc-kean/issues/645"},"comments":{"href":"https://api.github.com/repos/cogneco/ooc-kean/issues/645/comments"},"review_comments":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645/comments"},"review_comment":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cogneco/ooc-kean/pulls/645/commits"},"statuses":{"href":"https://api.github.com/repos/cogneco/ooc-kean/statuses/255d507c8c99bedb97ac8c49b37787a79a3adff0"}}}}