{"action":"created","comment":{"url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/comments/77332402","id":77332402,"diff_hunk":"@@ -25,14 +42,56 @@ public Address(String address, boolean isPrivate) throws IllegalValueException {\n         if (!isValidAddress(address)) {\n             throw new IllegalValueException(MESSAGE_ADDRESS_CONSTRAINTS);\n         }\n-        this.value = address;\n+        \n+        final String[] splitAddressComponents = address.trim().split(\",\");\n+        \n+    \tthis.block = new Block(splitAddressComponents[0].trim());\n+    \tthis.street = new Street(splitAddressComponents[1].trim());\n+    \tthis.unit = new Unit(splitAddressComponents[2].trim());\n+    \tthis.postalCode = new PostalCode(splitAddressComponents[3].trim());\n+    \tthis.value = address;\n     }\n-\n+    \n     /**\n-     * Returns true if a given string is a valid person email.\n+     * Returns true if a given string is a valid person address.\n      */\n     public static boolean isValidAddress(String test) {\n-        return test.matches(ADDRESS_VALIDATION_REGEX);\n+        if(!test.matches(ADDRESS_VALIDATION_REGEX))\n+        \treturn false;\n+        \n+        final String[] splitAddressComponents = test.trim().split(\",\");\n+        if(!isValidAddress(splitAddressComponents))\n+        \treturn false;\n+        \n+        return true;\n+    }\n+    \n+    /**\n+     * Valid individual part of the address\n+     * @param addressComponents\n+     * @return\n+     */\n+    public static boolean isValidAddress(String[] addressComponents){\n+    \treturn isBlockValid(addressComponents[ADDRESS_INDEX_BLOCK])\n+    \t\t\t&& isStreetValid(addressComponents[ADDRESS_INDEX_STREET])\n+    \t\t\t&& isUnitValid(addressComponents[ADDRESS_INDEX_UNIT])\n+    \t\t\t&& isPostalCodeValid(addressComponents[ADDRESS_INDEX_POSTAL_CODE]);\n+    }\n+    \n+    private static boolean isBlockValid(String block){\n+    \treturn block.trim().matches(ADDRESS_BLOCK_VALIDATION_REGEX);\n+    }\n+    ","path":"src/seedu/addressbook/data/person/Address.java","position":79,"original_position":79,"commit_id":"4fd6332164156a2230ad16523518ed1c3120fc7f","original_commit_id":"9f84b4503825588600912d1db300048af5fa3649","user":{"login":"jeffryhartanto","id":7631199,"avatar_url":"https://avatars.githubusercontent.com/u/7631199?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffryhartanto","html_url":"https://github.com/jeffryhartanto","followers_url":"https://api.github.com/users/jeffryhartanto/followers","following_url":"https://api.github.com/users/jeffryhartanto/following{/other_user}","gists_url":"https://api.github.com/users/jeffryhartanto/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffryhartanto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffryhartanto/subscriptions","organizations_url":"https://api.github.com/users/jeffryhartanto/orgs","repos_url":"https://api.github.com/users/jeffryhartanto/repos","events_url":"https://api.github.com/users/jeffryhartanto/events{/privacy}","received_events_url":"https://api.github.com/users/jeffryhartanto/received_events","type":"User","site_admin":false},"body":"Can consider putting this validation check in each respective class.","created_at":"2016-09-02T11:35:16Z","updated_at":"2016-09-02T11:35:16Z","html_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124#discussion_r77332402","pull_request_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124","_links":{"self":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/comments/77332402"},"html":{"href":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124#discussion_r77332402"},"pull_request":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124"}}},"pull_request":{"url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124","id":83019130,"html_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124","diff_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124.diff","patch_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124.patch","issue_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/124","number":124,"state":"open","locked":false,"title":"[T3A3][F09-A2]Xu Chen","user":{"login":"githubxxcc","id":11676094,"avatar_url":"https://avatars.githubusercontent.com/u/11676094?v=3","gravatar_id":"","url":"https://api.github.com/users/githubxxcc","html_url":"https://github.com/githubxxcc","followers_url":"https://api.github.com/users/githubxxcc/followers","following_url":"https://api.github.com/users/githubxxcc/following{/other_user}","gists_url":"https://api.github.com/users/githubxxcc/gists{/gist_id}","starred_url":"https://api.github.com/users/githubxxcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githubxxcc/subscriptions","organizations_url":"https://api.github.com/users/githubxxcc/orgs","repos_url":"https://api.github.com/users/githubxxcc/repos","events_url":"https://api.github.com/users/githubxxcc/events{/privacy}","received_events_url":"https://api.github.com/users/githubxxcc/received_events","type":"User","site_admin":false},"body":"Ready for review. ","created_at":"2016-08-28T15:43:19Z","updated_at":"2016-09-02T11:35:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5875ee55f589a9520e7a099ea9942511890eb0d","assignee":{"login":"jeffryhartanto","id":7631199,"avatar_url":"https://avatars.githubusercontent.com/u/7631199?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffryhartanto","html_url":"https://github.com/jeffryhartanto","followers_url":"https://api.github.com/users/jeffryhartanto/followers","following_url":"https://api.github.com/users/jeffryhartanto/following{/other_user}","gists_url":"https://api.github.com/users/jeffryhartanto/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffryhartanto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffryhartanto/subscriptions","organizations_url":"https://api.github.com/users/jeffryhartanto/orgs","repos_url":"https://api.github.com/users/jeffryhartanto/repos","events_url":"https://api.github.com/users/jeffryhartanto/events{/privacy}","received_events_url":"https://api.github.com/users/jeffryhartanto/received_events","type":"User","site_admin":false},"assignees":[{"login":"jeffryhartanto","id":7631199,"avatar_url":"https://avatars.githubusercontent.com/u/7631199?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffryhartanto","html_url":"https://github.com/jeffryhartanto","followers_url":"https://api.github.com/users/jeffryhartanto/followers","following_url":"https://api.github.com/users/jeffryhartanto/following{/other_user}","gists_url":"https://api.github.com/users/jeffryhartanto/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffryhartanto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffryhartanto/subscriptions","organizations_url":"https://api.github.com/users/jeffryhartanto/orgs","repos_url":"https://api.github.com/users/jeffryhartanto/repos","events_url":"https://api.github.com/users/jeffryhartanto/events{/privacy}","received_events_url":"https://api.github.com/users/jeffryhartanto/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124/commits","review_comments_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124/comments","review_comment_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/124/comments","statuses_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/statuses/4fd6332164156a2230ad16523518ed1c3120fc7f","head":{"label":"githubxxcc:T3A3","ref":"T3A3","sha":"4fd6332164156a2230ad16523518ed1c3120fc7f","user":{"login":"githubxxcc","id":11676094,"avatar_url":"https://avatars.githubusercontent.com/u/11676094?v=3","gravatar_id":"","url":"https://api.github.com/users/githubxxcc","html_url":"https://github.com/githubxxcc","followers_url":"https://api.github.com/users/githubxxcc/followers","following_url":"https://api.github.com/users/githubxxcc/following{/other_user}","gists_url":"https://api.github.com/users/githubxxcc/gists{/gist_id}","starred_url":"https://api.github.com/users/githubxxcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githubxxcc/subscriptions","organizations_url":"https://api.github.com/users/githubxxcc/orgs","repos_url":"https://api.github.com/users/githubxxcc/repos","events_url":"https://api.github.com/users/githubxxcc/events{/privacy}","received_events_url":"https://api.github.com/users/githubxxcc/received_events","type":"User","site_admin":false},"repo":{"id":66759442,"name":"addressbook-level2","full_name":"githubxxcc/addressbook-level2","owner":{"login":"githubxxcc","id":11676094,"avatar_url":"https://avatars.githubusercontent.com/u/11676094?v=3","gravatar_id":"","url":"https://api.github.com/users/githubxxcc","html_url":"https://github.com/githubxxcc","followers_url":"https://api.github.com/users/githubxxcc/followers","following_url":"https://api.github.com/users/githubxxcc/following{/other_user}","gists_url":"https://api.github.com/users/githubxxcc/gists{/gist_id}","starred_url":"https://api.github.com/users/githubxxcc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/githubxxcc/subscriptions","organizations_url":"https://api.github.com/users/githubxxcc/orgs","repos_url":"https://api.github.com/users/githubxxcc/repos","events_url":"https://api.github.com/users/githubxxcc/events{/privacy}","received_events_url":"https://api.github.com/users/githubxxcc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/githubxxcc/addressbook-level2","description":"A Java sample application for students. An AddressBook application that uses OOP basics.","fork":true,"url":"https://api.github.com/repos/githubxxcc/addressbook-level2","forks_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/forks","keys_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/teams","hooks_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/hooks","issue_events_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/issues/events{/number}","events_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/events","assignees_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/assignees{/user}","branches_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/branches{/branch}","tags_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/tags","blobs_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/git/refs{/sha}","trees_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/statuses/{sha}","languages_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/languages","stargazers_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/stargazers","contributors_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/contributors","subscribers_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/subscribers","subscription_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/subscription","commits_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/commits{/sha}","git_commits_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/git/commits{/sha}","comments_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/comments{/number}","issue_comment_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/issues/comments{/number}","contents_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/contents/{+path}","compare_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/merges","archive_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/downloads","issues_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/issues{/number}","pulls_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/pulls{/number}","milestones_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/milestones{/number}","notifications_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/labels{/name}","releases_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/releases{/id}","deployments_url":"https://api.github.com/repos/githubxxcc/addressbook-level2/deployments","created_at":"2016-08-28T09:10:57Z","updated_at":"2016-08-28T09:10:58Z","pushed_at":"2016-08-29T13:56:26Z","git_url":"git://github.com/githubxxcc/addressbook-level2.git","ssh_url":"git@github.com:githubxxcc/addressbook-level2.git","clone_url":"https://github.com/githubxxcc/addressbook-level2.git","svn_url":"https://github.com/githubxxcc/addressbook-level2","homepage":null,"size":2933,"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":"nus-cs2103-AY1617S1:master","ref":"master","sha":"19f22e05d9fa4c555d2526f2ed3e70fb336eb43a","user":{"login":"nus-cs2103-AY1617S1","id":20475842,"avatar_url":"https://avatars.githubusercontent.com/u/20475842?v=3","gravatar_id":"","url":"https://api.github.com/users/nus-cs2103-AY1617S1","html_url":"https://github.com/nus-cs2103-AY1617S1","followers_url":"https://api.github.com/users/nus-cs2103-AY1617S1/followers","following_url":"https://api.github.com/users/nus-cs2103-AY1617S1/following{/other_user}","gists_url":"https://api.github.com/users/nus-cs2103-AY1617S1/gists{/gist_id}","starred_url":"https://api.github.com/users/nus-cs2103-AY1617S1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nus-cs2103-AY1617S1/subscriptions","organizations_url":"https://api.github.com/users/nus-cs2103-AY1617S1/orgs","repos_url":"https://api.github.com/users/nus-cs2103-AY1617S1/repos","events_url":"https://api.github.com/users/nus-cs2103-AY1617S1/events{/privacy}","received_events_url":"https://api.github.com/users/nus-cs2103-AY1617S1/received_events","type":"Organization","site_admin":false},"repo":{"id":66551047,"name":"addressbook-level2","full_name":"nus-cs2103-AY1617S1/addressbook-level2","owner":{"login":"nus-cs2103-AY1617S1","id":20475842,"avatar_url":"https://avatars.githubusercontent.com/u/20475842?v=3","gravatar_id":"","url":"https://api.github.com/users/nus-cs2103-AY1617S1","html_url":"https://github.com/nus-cs2103-AY1617S1","followers_url":"https://api.github.com/users/nus-cs2103-AY1617S1/followers","following_url":"https://api.github.com/users/nus-cs2103-AY1617S1/following{/other_user}","gists_url":"https://api.github.com/users/nus-cs2103-AY1617S1/gists{/gist_id}","starred_url":"https://api.github.com/users/nus-cs2103-AY1617S1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nus-cs2103-AY1617S1/subscriptions","organizations_url":"https://api.github.com/users/nus-cs2103-AY1617S1/orgs","repos_url":"https://api.github.com/users/nus-cs2103-AY1617S1/repos","events_url":"https://api.github.com/users/nus-cs2103-AY1617S1/events{/privacy}","received_events_url":"https://api.github.com/users/nus-cs2103-AY1617S1/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2","description":"A Java sample application for students. An AddressBook application that uses OOP basics.","fork":true,"url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2","forks_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/forks","keys_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/teams","hooks_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/hooks","issue_events_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/events{/number}","events_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/events","assignees_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/assignees{/user}","branches_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/branches{/branch}","tags_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/tags","blobs_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/git/refs{/sha}","trees_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/statuses/{sha}","languages_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/languages","stargazers_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/stargazers","contributors_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/contributors","subscribers_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/subscribers","subscription_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/subscription","commits_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/commits{/sha}","git_commits_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/git/commits{/sha}","comments_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/comments{/number}","issue_comment_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/comments{/number}","contents_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/contents/{+path}","compare_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/merges","archive_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/downloads","issues_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues{/number}","pulls_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls{/number}","milestones_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/milestones{/number}","notifications_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/labels{/name}","releases_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/releases{/id}","deployments_url":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/deployments","created_at":"2016-08-25T11:09:03Z","updated_at":"2016-08-31T14:24:36Z","pushed_at":"2016-09-02T11:30:40Z","git_url":"git://github.com/nus-cs2103-AY1617S1/addressbook-level2.git","ssh_url":"git@github.com:nus-cs2103-AY1617S1/addressbook-level2.git","clone_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2.git","svn_url":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2","homepage":null,"size":3960,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":247,"mirror_url":null,"open_issues_count":398,"forks":247,"open_issues":398,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124"},"html":{"href":"https://github.com/nus-cs2103-AY1617S1/addressbook-level2/pull/124"},"issue":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/124"},"comments":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/issues/124/comments"},"review_comments":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124/comments"},"review_comment":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/pulls/124/commits"},"statuses":{"href":"https://api.github.com/repos/nus-cs2103-AY1617S1/addressbook-level2/statuses/4fd6332164156a2230ad16523518ed1c3120fc7f"}}}}
{"actor":{"display_login":"jeffryhartanto"}}