{"action":"created","comment":{"url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/comments/232414466","pull_request_review_id":173617340,"id":232414466,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjQxNDQ2Ng==","diff_hunk":"@@ -1,9 +1,81 @@\n package edu.texas.social_computing.hospitals;\n \n-import java.util.Queue;\n+import java.util.*;\n \n public class HRP {\n+    private HRP() {}\n+\n+    /**\n+     * From: The Hospitals / Residents Problem (1962; Gale, Shapley)\n+     * David F. Manlove\n+     * https://pdfs.semanticscholar.org/77d9/f84082674888ca90ca662847983381b23338.pdf?_ga=2.216999441.622816506.1541285838-70410261.1541285838\n+     *\n+     * M := ∅;\n+     * while (some resident r_i is unassigned and r_i has a non-empty list) {\n+     *     h_j := first hospital on r_i’s list;\n+     *     // r_i applies to h_j\n+     *     M := M ∪ {(r_i, h_j)};\n+     *     if (h_j is over-subscribed) {\n+     *             r_k := worst resident in M(h_j) according to h_j’s list;\n+     *             M := M\\{(r_k, h_j)};\n+     *     }\n+     *     if (h_j is full) {\n+     *             r_k := worst resident in M(h_j) according to h_j’s list;\n+     *             for (each successor r_l of r_k on h_j’s list)\n+     *             delete the pair (r_l, h_j);\n+     *     }\n+     * }\n+     */\n+\n     public static Matching run(HospitalTable hospitalTable, ResidentTable residentTable, Queue<Resident> freeResidents) {\n-        return null;\n+        Iterator<Resident> freeResidentsItir = freeResidents.iterator();\n+        Matching m = new Matching();\n+\n+        Map<Hospital,List<String>> HospitalsPrefs = new HashMap<>();\n+        for (Hospital hospital: hospitalTable.getAll()) {\n+            HospitalsPrefs.put(hospital,hospital.getPreferences());\n+        }\n+\n+        Map<Resident,List<String>> ResidentsPrefs = new HashMap<>();\n+        for (Resident resident: residentTable.getAll()) {\n+            ResidentsPrefs.put(resident,resident.getPreferences());\n+        }\n+\n+        Resident currentResident = freeResidentsItir.next();\n+        List<String> currentResidentPref = ResidentsPrefs.get(currentResident);\n+        Iterator currentResidentPrefItir = currentResidentPref.iterator();","path":"src/main/java/edu/texas/social_computing/hospitals/HRP.java","position":53,"original_position":48,"commit_id":"4193e9f74ce95320898461cd3a1293956f0d818f","original_commit_id":"87cf2a25047a51f26ec6e7ccade36a304e8d97e1","user":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"body":"Ok","created_at":"2018-11-09T22:39:25Z","updated_at":"2018-11-09T22:39:25Z","html_url":"https://github.com/abruck1/Social_Computing_Project/pull/6#discussion_r232414466","pull_request_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/comments/232414466"},"html":{"href":"https://github.com/abruck1/Social_Computing_Project/pull/6#discussion_r232414466"},"pull_request":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6"}},"in_reply_to_id":232411377},"pull_request":{"url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6","id":229772186,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5NzcyMTg2","html_url":"https://github.com/abruck1/Social_Computing_Project/pull/6","diff_url":"https://github.com/abruck1/Social_Computing_Project/pull/6.diff","patch_url":"https://github.com/abruck1/Social_Computing_Project/pull/6.patch","issue_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/6","number":6,"state":"open","locked":false,"title":"Added HRP run","user":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-09T17:55:42Z","updated_at":"2018-11-09T22:39:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c670121dfe4a74c6d451dda3d51d082fec7a479","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6/commits","review_comments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6/comments","review_comment_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/comments{/number}","comments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/6/comments","statuses_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/statuses/4193e9f74ce95320898461cd3a1293956f0d818f","head":{"label":"abruck1:HRP","ref":"HRP","sha":"4193e9f74ce95320898461cd3a1293956f0d818f","user":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"repo":{"id":156035931,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYwMzU5MzE=","name":"Social_Computing_Project","full_name":"abruck1/Social_Computing_Project","private":false,"owner":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/abruck1/Social_Computing_Project","description":null,"fork":false,"url":"https://api.github.com/repos/abruck1/Social_Computing_Project","forks_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/forks","keys_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/teams","hooks_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/hooks","issue_events_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/events{/number}","events_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/events","assignees_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/assignees{/user}","branches_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/branches{/branch}","tags_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/tags","blobs_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/refs{/sha}","trees_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/statuses/{sha}","languages_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/languages","stargazers_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/stargazers","contributors_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/contributors","subscribers_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/subscribers","subscription_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/subscription","commits_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/commits{/sha}","git_commits_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/commits{/sha}","comments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/comments{/number}","issue_comment_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/comments{/number}","contents_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/contents/{+path}","compare_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/merges","archive_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/downloads","issues_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues{/number}","pulls_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls{/number}","milestones_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/milestones{/number}","notifications_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/labels{/name}","releases_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/releases{/id}","deployments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/deployments","created_at":"2018-11-04T00:31:54Z","updated_at":"2018-11-09T20:29:12Z","pushed_at":"2018-11-09T22:24:56Z","git_url":"git://github.com/abruck1/Social_Computing_Project.git","ssh_url":"git@github.com:abruck1/Social_Computing_Project.git","clone_url":"https://github.com/abruck1/Social_Computing_Project.git","svn_url":"https://github.com/abruck1/Social_Computing_Project","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Java","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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"abruck1:master","ref":"master","sha":"289f232930b76be4783a40728455a9084e8f98b6","user":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"repo":{"id":156035931,"node_id":"MDEwOlJlcG9zaXRvcnkxNTYwMzU5MzE=","name":"Social_Computing_Project","full_name":"abruck1/Social_Computing_Project","private":false,"owner":{"login":"abruck1","id":29669020,"node_id":"MDQ6VXNlcjI5NjY5MDIw","avatar_url":"https://avatars3.githubusercontent.com/u/29669020?v=4","gravatar_id":"","url":"https://api.github.com/users/abruck1","html_url":"https://github.com/abruck1","followers_url":"https://api.github.com/users/abruck1/followers","following_url":"https://api.github.com/users/abruck1/following{/other_user}","gists_url":"https://api.github.com/users/abruck1/gists{/gist_id}","starred_url":"https://api.github.com/users/abruck1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abruck1/subscriptions","organizations_url":"https://api.github.com/users/abruck1/orgs","repos_url":"https://api.github.com/users/abruck1/repos","events_url":"https://api.github.com/users/abruck1/events{/privacy}","received_events_url":"https://api.github.com/users/abruck1/received_events","type":"User","site_admin":false},"html_url":"https://github.com/abruck1/Social_Computing_Project","description":null,"fork":false,"url":"https://api.github.com/repos/abruck1/Social_Computing_Project","forks_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/forks","keys_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/teams","hooks_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/hooks","issue_events_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/events{/number}","events_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/events","assignees_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/assignees{/user}","branches_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/branches{/branch}","tags_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/tags","blobs_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/refs{/sha}","trees_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/statuses/{sha}","languages_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/languages","stargazers_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/stargazers","contributors_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/contributors","subscribers_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/subscribers","subscription_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/subscription","commits_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/commits{/sha}","git_commits_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/git/commits{/sha}","comments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/comments{/number}","issue_comment_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/comments{/number}","contents_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/contents/{+path}","compare_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/merges","archive_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/downloads","issues_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues{/number}","pulls_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls{/number}","milestones_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/milestones{/number}","notifications_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/labels{/name}","releases_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/releases{/id}","deployments_url":"https://api.github.com/repos/abruck1/Social_Computing_Project/deployments","created_at":"2018-11-04T00:31:54Z","updated_at":"2018-11-09T20:29:12Z","pushed_at":"2018-11-09T22:24:56Z","git_url":"git://github.com/abruck1/Social_Computing_Project.git","ssh_url":"git@github.com:abruck1/Social_Computing_Project.git","clone_url":"https://github.com/abruck1/Social_Computing_Project.git","svn_url":"https://github.com/abruck1/Social_Computing_Project","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Java","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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6"},"html":{"href":"https://github.com/abruck1/Social_Computing_Project/pull/6"},"issue":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/6"},"comments":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/abruck1/Social_Computing_Project/statuses/4193e9f74ce95320898461cd3a1293956f0d818f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"abruck1"}}