{"action":"created","comment":{"url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/comments/183986827","pull_request_review_id":115088417,"id":183986827,"diff_hunk":"@@ -0,0 +1,166 @@\n+package group144.shervashidze.HashTable;\n+\n+import java.util.ArrayList;\n+import java.util.LinkedList;\n+\n+public class HashTable {\n+    private HashFunction hashFunction;\n+    private ArrayList<LinkedList<String>> elements;\n+\n+    /**\n+     * HashTable.\n+     *\n+     * @param hashFunction, mod of hashFunction is also mod of hashTable.\n+     */\n+    public HashTable (HashFunction hashFunction) {\n+        this.hashFunction = hashFunction;\n+\n+        this.elements = new ArrayList<>(hashFunction.getMod());\n+        for (int i = 0; i < hashFunction.getMod(); i++) {\n+            this.elements.add(new LinkedList<>());\n+        }\n+    }\n+\n+    /**\n+     * @param string to add in hashTable.\n+     * row to add: value of hashFunction with this string.\n+     */\n+    public void add(String string) {\n+        if (contains(string))\n+            return;\n+        int hash = hashFunction.hash(string);\n+        elements.get(hash).add(string);\n+    }\n+\n+    /**\n+     * @param string to remove from hashTable.\n+     * If there is't this string does nothing.\n+     */\n+    public void remove(String string) {\n+        if (!contains(string))\n+            return;\n+        int hash = hashFunction.hash(string);\n+        elements.get(hash).remove(string);\n+    }\n+\n+    /**\n+     *\n+     * @param string to find.\n+     * @return in which row string is.\n+     */\n+    public int find(String string) {\n+        int hash = hashFunction.hash(string);\n+        if (contains(string)) {\n+            return hash;\n+        } else {\n+            return -1;\n+        }\n+    }\n+\n+    /**\n+     *\n+     * @return statistic: Load factor, amount of conflicts, elements and empty rows, max chain length.\n+     */\n+    public String getStatistics() {\n+        int amount = countElements();\n+        int empty = CountEmptyRows();\n+\n+        int maxChainLength = 0;\n+        for (LinkedList<String> row : elements)\n+            maxChainLength = Integer.max(maxChainLength, row.size());\n+\n+        int notAlone = 0;\n+        for (LinkedList<String> row : elements)\n+            if (row.size() > 1)\n+                notAlone++;\n+\n+        String loadFactorInfo = String.format(\"Load factor: %f\", getLoadFactor());\n+        String conflicts = String.format(\"Conflicts: %d\", notAlone);\n+        String elements = String.format(\"Amount of elements: %d\", amount);\n+        String emptyRows = String.format(\"Amount of empty rows: %d\", empty);\n+        String maxLength = String.format(\"Max chain length: %d\", maxChainLength);\n+        return String.join(\"\\n\", elements, emptyRows, loadFactorInfo, conflicts, maxLength, \"\\n\");\n+    }\n+\n+    /**\n+     *\n+     * @return amount of empty rows.\n+     */\n+    private int CountEmptyRows() {","path":"sem 2/3 hw/1/src/main/java/group144/shervashidze/HashTable/HashTable.java","position":89,"original_position":89,"commit_id":"6602fe38374decffcaa00f294274b038c49804d5","original_commit_id":"6602fe38374decffcaa00f294274b038c49804d5","user":{"login":"jzuken","id":705678,"avatar_url":"https://avatars1.githubusercontent.com/u/705678?v=4","gravatar_id":"","url":"https://api.github.com/users/jzuken","html_url":"https://github.com/jzuken","followers_url":"https://api.github.com/users/jzuken/followers","following_url":"https://api.github.com/users/jzuken/following{/other_user}","gists_url":"https://api.github.com/users/jzuken/gists{/gist_id}","starred_url":"https://api.github.com/users/jzuken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzuken/subscriptions","organizations_url":"https://api.github.com/users/jzuken/orgs","repos_url":"https://api.github.com/users/jzuken/repos","events_url":"https://api.github.com/users/jzuken/events{/privacy}","received_events_url":"https://api.github.com/users/jzuken/received_events","type":"User","site_admin":false},"body":"стайлгайд","created_at":"2018-04-25T09:00:59Z","updated_at":"2018-04-25T09:01:48Z","html_url":"https://github.com/Shervashidze/SPBU/pull/42#discussion_r183986827","pull_request_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/comments/183986827"},"html":{"href":"https://github.com/Shervashidze/SPBU/pull/42#discussion_r183986827"},"pull_request":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42","id":180186599,"html_url":"https://github.com/Shervashidze/SPBU/pull/42","diff_url":"https://github.com/Shervashidze/SPBU/pull/42.diff","patch_url":"https://github.com/Shervashidze/SPBU/pull/42.patch","issue_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/42","number":42,"state":"open","locked":false,"title":"adding 3.1","user":{"login":"Shervashidze","id":33333462,"avatar_url":"https://avatars2.githubusercontent.com/u/33333462?v=4","gravatar_id":"","url":"https://api.github.com/users/Shervashidze","html_url":"https://github.com/Shervashidze","followers_url":"https://api.github.com/users/Shervashidze/followers","following_url":"https://api.github.com/users/Shervashidze/following{/other_user}","gists_url":"https://api.github.com/users/Shervashidze/gists{/gist_id}","starred_url":"https://api.github.com/users/Shervashidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shervashidze/subscriptions","organizations_url":"https://api.github.com/users/Shervashidze/orgs","repos_url":"https://api.github.com/users/Shervashidze/repos","events_url":"https://api.github.com/users/Shervashidze/events{/privacy}","received_events_url":"https://api.github.com/users/Shervashidze/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-08T23:27:17Z","updated_at":"2018-04-25T09:01:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"69f7369ed7cc351d6a06ef9cb40151263d84beb5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42/commits","review_comments_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42/comments","review_comment_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/42/comments","statuses_url":"https://api.github.com/repos/Shervashidze/SPBU/statuses/6602fe38374decffcaa00f294274b038c49804d5","head":{"label":"Shervashidze:3.1","ref":"3.1","sha":"6602fe38374decffcaa00f294274b038c49804d5","user":{"login":"Shervashidze","id":33333462,"avatar_url":"https://avatars2.githubusercontent.com/u/33333462?v=4","gravatar_id":"","url":"https://api.github.com/users/Shervashidze","html_url":"https://github.com/Shervashidze","followers_url":"https://api.github.com/users/Shervashidze/followers","following_url":"https://api.github.com/users/Shervashidze/following{/other_user}","gists_url":"https://api.github.com/users/Shervashidze/gists{/gist_id}","starred_url":"https://api.github.com/users/Shervashidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shervashidze/subscriptions","organizations_url":"https://api.github.com/users/Shervashidze/orgs","repos_url":"https://api.github.com/users/Shervashidze/repos","events_url":"https://api.github.com/users/Shervashidze/events{/privacy}","received_events_url":"https://api.github.com/users/Shervashidze/received_events","type":"User","site_admin":false},"repo":{"id":109325362,"name":"SPBU","full_name":"Shervashidze/SPBU","owner":{"login":"Shervashidze","id":33333462,"avatar_url":"https://avatars2.githubusercontent.com/u/33333462?v=4","gravatar_id":"","url":"https://api.github.com/users/Shervashidze","html_url":"https://github.com/Shervashidze","followers_url":"https://api.github.com/users/Shervashidze/followers","following_url":"https://api.github.com/users/Shervashidze/following{/other_user}","gists_url":"https://api.github.com/users/Shervashidze/gists{/gist_id}","starred_url":"https://api.github.com/users/Shervashidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shervashidze/subscriptions","organizations_url":"https://api.github.com/users/Shervashidze/orgs","repos_url":"https://api.github.com/users/Shervashidze/repos","events_url":"https://api.github.com/users/Shervashidze/events{/privacy}","received_events_url":"https://api.github.com/users/Shervashidze/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Shervashidze/SPBU","description":"SPBU projects and homework","fork":false,"url":"https://api.github.com/repos/Shervashidze/SPBU","forks_url":"https://api.github.com/repos/Shervashidze/SPBU/forks","keys_url":"https://api.github.com/repos/Shervashidze/SPBU/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shervashidze/SPBU/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shervashidze/SPBU/teams","hooks_url":"https://api.github.com/repos/Shervashidze/SPBU/hooks","issue_events_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/events{/number}","events_url":"https://api.github.com/repos/Shervashidze/SPBU/events","assignees_url":"https://api.github.com/repos/Shervashidze/SPBU/assignees{/user}","branches_url":"https://api.github.com/repos/Shervashidze/SPBU/branches{/branch}","tags_url":"https://api.github.com/repos/Shervashidze/SPBU/tags","blobs_url":"https://api.github.com/repos/Shervashidze/SPBU/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shervashidze/SPBU/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shervashidze/SPBU/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shervashidze/SPBU/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shervashidze/SPBU/statuses/{sha}","languages_url":"https://api.github.com/repos/Shervashidze/SPBU/languages","stargazers_url":"https://api.github.com/repos/Shervashidze/SPBU/stargazers","contributors_url":"https://api.github.com/repos/Shervashidze/SPBU/contributors","subscribers_url":"https://api.github.com/repos/Shervashidze/SPBU/subscribers","subscription_url":"https://api.github.com/repos/Shervashidze/SPBU/subscription","commits_url":"https://api.github.com/repos/Shervashidze/SPBU/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shervashidze/SPBU/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shervashidze/SPBU/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shervashidze/SPBU/contents/{+path}","compare_url":"https://api.github.com/repos/Shervashidze/SPBU/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shervashidze/SPBU/merges","archive_url":"https://api.github.com/repos/Shervashidze/SPBU/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shervashidze/SPBU/downloads","issues_url":"https://api.github.com/repos/Shervashidze/SPBU/issues{/number}","pulls_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls{/number}","milestones_url":"https://api.github.com/repos/Shervashidze/SPBU/milestones{/number}","notifications_url":"https://api.github.com/repos/Shervashidze/SPBU/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shervashidze/SPBU/labels{/name}","releases_url":"https://api.github.com/repos/Shervashidze/SPBU/releases{/id}","deployments_url":"https://api.github.com/repos/Shervashidze/SPBU/deployments","created_at":"2017-11-02T22:29:00Z","updated_at":"2018-04-15T14:16:28Z","pushed_at":"2018-04-15T16:20:53Z","git_url":"git://github.com/Shervashidze/SPBU.git","ssh_url":"git@github.com:Shervashidze/SPBU.git","clone_url":"https://github.com/Shervashidze/SPBU.git","svn_url":"https://github.com/Shervashidze/SPBU","homepage":null,"size":214,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"Shervashidze:master","ref":"master","sha":"4dd9c2e36d8ddedccd76468fa5bce6594d701260","user":{"login":"Shervashidze","id":33333462,"avatar_url":"https://avatars2.githubusercontent.com/u/33333462?v=4","gravatar_id":"","url":"https://api.github.com/users/Shervashidze","html_url":"https://github.com/Shervashidze","followers_url":"https://api.github.com/users/Shervashidze/followers","following_url":"https://api.github.com/users/Shervashidze/following{/other_user}","gists_url":"https://api.github.com/users/Shervashidze/gists{/gist_id}","starred_url":"https://api.github.com/users/Shervashidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shervashidze/subscriptions","organizations_url":"https://api.github.com/users/Shervashidze/orgs","repos_url":"https://api.github.com/users/Shervashidze/repos","events_url":"https://api.github.com/users/Shervashidze/events{/privacy}","received_events_url":"https://api.github.com/users/Shervashidze/received_events","type":"User","site_admin":false},"repo":{"id":109325362,"name":"SPBU","full_name":"Shervashidze/SPBU","owner":{"login":"Shervashidze","id":33333462,"avatar_url":"https://avatars2.githubusercontent.com/u/33333462?v=4","gravatar_id":"","url":"https://api.github.com/users/Shervashidze","html_url":"https://github.com/Shervashidze","followers_url":"https://api.github.com/users/Shervashidze/followers","following_url":"https://api.github.com/users/Shervashidze/following{/other_user}","gists_url":"https://api.github.com/users/Shervashidze/gists{/gist_id}","starred_url":"https://api.github.com/users/Shervashidze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shervashidze/subscriptions","organizations_url":"https://api.github.com/users/Shervashidze/orgs","repos_url":"https://api.github.com/users/Shervashidze/repos","events_url":"https://api.github.com/users/Shervashidze/events{/privacy}","received_events_url":"https://api.github.com/users/Shervashidze/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Shervashidze/SPBU","description":"SPBU projects and homework","fork":false,"url":"https://api.github.com/repos/Shervashidze/SPBU","forks_url":"https://api.github.com/repos/Shervashidze/SPBU/forks","keys_url":"https://api.github.com/repos/Shervashidze/SPBU/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shervashidze/SPBU/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shervashidze/SPBU/teams","hooks_url":"https://api.github.com/repos/Shervashidze/SPBU/hooks","issue_events_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/events{/number}","events_url":"https://api.github.com/repos/Shervashidze/SPBU/events","assignees_url":"https://api.github.com/repos/Shervashidze/SPBU/assignees{/user}","branches_url":"https://api.github.com/repos/Shervashidze/SPBU/branches{/branch}","tags_url":"https://api.github.com/repos/Shervashidze/SPBU/tags","blobs_url":"https://api.github.com/repos/Shervashidze/SPBU/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shervashidze/SPBU/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shervashidze/SPBU/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shervashidze/SPBU/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shervashidze/SPBU/statuses/{sha}","languages_url":"https://api.github.com/repos/Shervashidze/SPBU/languages","stargazers_url":"https://api.github.com/repos/Shervashidze/SPBU/stargazers","contributors_url":"https://api.github.com/repos/Shervashidze/SPBU/contributors","subscribers_url":"https://api.github.com/repos/Shervashidze/SPBU/subscribers","subscription_url":"https://api.github.com/repos/Shervashidze/SPBU/subscription","commits_url":"https://api.github.com/repos/Shervashidze/SPBU/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shervashidze/SPBU/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shervashidze/SPBU/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shervashidze/SPBU/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shervashidze/SPBU/contents/{+path}","compare_url":"https://api.github.com/repos/Shervashidze/SPBU/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shervashidze/SPBU/merges","archive_url":"https://api.github.com/repos/Shervashidze/SPBU/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shervashidze/SPBU/downloads","issues_url":"https://api.github.com/repos/Shervashidze/SPBU/issues{/number}","pulls_url":"https://api.github.com/repos/Shervashidze/SPBU/pulls{/number}","milestones_url":"https://api.github.com/repos/Shervashidze/SPBU/milestones{/number}","notifications_url":"https://api.github.com/repos/Shervashidze/SPBU/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shervashidze/SPBU/labels{/name}","releases_url":"https://api.github.com/repos/Shervashidze/SPBU/releases{/id}","deployments_url":"https://api.github.com/repos/Shervashidze/SPBU/deployments","created_at":"2017-11-02T22:29:00Z","updated_at":"2018-04-15T14:16:28Z","pushed_at":"2018-04-15T16:20:53Z","git_url":"git://github.com/Shervashidze/SPBU.git","ssh_url":"git@github.com:Shervashidze/SPBU.git","clone_url":"https://github.com/Shervashidze/SPBU.git","svn_url":"https://github.com/Shervashidze/SPBU","homepage":null,"size":214,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":null,"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42"},"html":{"href":"https://github.com/Shervashidze/SPBU/pull/42"},"issue":{"href":"https://api.github.com/repos/Shervashidze/SPBU/issues/42"},"comments":{"href":"https://api.github.com/repos/Shervashidze/SPBU/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shervashidze/SPBU/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/Shervashidze/SPBU/statuses/6602fe38374decffcaa00f294274b038c49804d5"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jzuken"}}