{"action":"created","comment":{"url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/comments/45835791","id":45835791,"diff_hunk":"@@ -0,0 +1,63 @@\n+package TruthTable;\n+//class for validation\n+public class Validation {\n+\t//method to check given input valid or not\n+\tpublic static boolean validate(String input) throws MyException {\n+\t\tException e = null; //MyException Object\n+\t\t//to check if input contains tow or more operator consecutively then throw exception\n+\t\tif (input.contains(\"&&\") || input.contains(\"||\")\n+\t\t\t\t|| input.contains(\"~~\") || input.contains(\"&|\")\n+\t\t\t\t|| input.contains(\"|&\") || input.contains(\"~&\")\n+\t\t\t\t|| input.contains(\"~|\"))\n+\t\t\treturn false;\n+\t\t//variables for count \n+\t\tint countOperand = 0;\n+\t\tint countOperator = 0;\n+\t\tint countOpenBrac = 0;\n+\t\tint countCloseBrac = 0;\n+\t\tchar startChar = input.charAt(0);\n+\t\tchar lastChar = input.charAt(input.length()-1);\n+\t\tint count = 0;\n+\t\tchar currentChar;\n+\t\twhile (count < input.length()) {\n+\t\t\tcurrentChar = input.charAt(count);\n+\t\t\tif(count < input.length()-2 &&  currentChar == '~' && (input.charAt(count+2) == '~' || input.charAt(count+2) == '('))\n+\t\t\t\treturn false;\n+\t\t\telse if(TruthTable.isLatter(currentChar) && (input.charAt(count+1) == '('))\n+\t\t\t\t\treturn false;\n+\t\t\telse if(currentChar == '(' && input.charAt(count+2) == ')') {\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t\telse if(startChar == ')' || startChar == '&' || startChar == '|' || lastChar =='~' || lastChar == '&' || lastChar == '|') {\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t\telse if (currentChar == '|' || currentChar == '&' || currentChar == '~') {\n+\t\t\t\tcountOperator++;\n+\t\t\t\tcount++;\n+\t\t\t} \n+\t\t\telse if ((currentChar >= 'a' && currentChar <= 'z')\n+\t\t\t\t\t|| (currentChar >= 'A' && currentChar <= 'Z')) {\n+\t\t\t\tcountOperand++;\n+\t\t\t\tcount++;\n+\t\t\t}\n+\t\t\telse if (currentChar == '(') {\n+\t\t\t\tcountOpenBrac++;\n+\t\t\t\tcount++;\n+\t\t\t}\n+\t\t\telse if (currentChar == ')') {\n+\t\t\t\tcountCloseBrac++;\n+\t\t\t\tcount++;\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tthrow new MyException(e);\n+\t\t\t}\n+\t\t}\n+\t\t//condition for returning true or false\n+\t\tif(countCloseBrac != countOpenBrac)\n+\t\t\treturn false;\n+\t\telse if((countOperator == 2*countOperand-1) || (countOperand == countOperator+1) || (countOperand == countOperator) || (countOperand+1 == countOperator) || countOperator == countOperand*2)\n+\t\t\treturn true;\n+\t\telse \n+\t\t\treturn true;\n+\t}\n+}","path":"AdvanceDS/TruthTable/Validation.java","position":63,"original_position":63,"commit_id":"da477f80c616a4259212a89860094a06cfee7831","original_commit_id":"da477f80c616a4259212a89860094a06cfee7831","user":{"login":"vikas1885","id":10379301,"avatar_url":"https://avatars.githubusercontent.com/u/10379301?v=3","gravatar_id":"","url":"https://api.github.com/users/vikas1885","html_url":"https://github.com/vikas1885","followers_url":"https://api.github.com/users/vikas1885/followers","following_url":"https://api.github.com/users/vikas1885/following{/other_user}","gists_url":"https://api.github.com/users/vikas1885/gists{/gist_id}","starred_url":"https://api.github.com/users/vikas1885/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikas1885/subscriptions","organizations_url":"https://api.github.com/users/vikas1885/orgs","repos_url":"https://api.github.com/users/vikas1885/repos","events_url":"https://api.github.com/users/vikas1885/events{/privacy}","received_events_url":"https://api.github.com/users/vikas1885/received_events","type":"User","site_admin":false},"body":"Third question is not submitted.","created_at":"2015-11-25T07:29:26Z","updated_at":"2015-11-25T07:29:26Z","html_url":"https://github.com/Avinash-barola/get2015/pull/35#discussion_r45835791","pull_request_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/comments/45835791"},"html":{"href":"https://github.com/Avinash-barola/get2015/pull/35#discussion_r45835791"},"pull_request":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35","id":47243317,"html_url":"https://github.com/Avinash-barola/get2015/pull/35","diff_url":"https://github.com/Avinash-barola/get2015/pull/35.diff","patch_url":"https://github.com/Avinash-barola/get2015/pull/35.patch","issue_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/35","number":35,"state":"open","locked":false,"title":"Advance ds avinash assignment 1","user":{"login":"Avinash-barola","id":13676864,"avatar_url":"https://avatars.githubusercontent.com/u/13676864?v=3","gravatar_id":"","url":"https://api.github.com/users/Avinash-barola","html_url":"https://github.com/Avinash-barola","followers_url":"https://api.github.com/users/Avinash-barola/followers","following_url":"https://api.github.com/users/Avinash-barola/following{/other_user}","gists_url":"https://api.github.com/users/Avinash-barola/gists{/gist_id}","starred_url":"https://api.github.com/users/Avinash-barola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avinash-barola/subscriptions","organizations_url":"https://api.github.com/users/Avinash-barola/orgs","repos_url":"https://api.github.com/users/Avinash-barola/repos","events_url":"https://api.github.com/users/Avinash-barola/events{/privacy}","received_events_url":"https://api.github.com/users/Avinash-barola/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-10-09T07:54:57Z","updated_at":"2015-11-25T07:29:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7401e9dea7329e31e9584b3fcd0dda152fc9dd3","assignee":{"login":"vikas1885","id":10379301,"avatar_url":"https://avatars.githubusercontent.com/u/10379301?v=3","gravatar_id":"","url":"https://api.github.com/users/vikas1885","html_url":"https://github.com/vikas1885","followers_url":"https://api.github.com/users/vikas1885/followers","following_url":"https://api.github.com/users/vikas1885/following{/other_user}","gists_url":"https://api.github.com/users/vikas1885/gists{/gist_id}","starred_url":"https://api.github.com/users/vikas1885/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vikas1885/subscriptions","organizations_url":"https://api.github.com/users/vikas1885/orgs","repos_url":"https://api.github.com/users/vikas1885/repos","events_url":"https://api.github.com/users/vikas1885/events{/privacy}","received_events_url":"https://api.github.com/users/vikas1885/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35/commits","review_comments_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35/comments","review_comment_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/35/comments","statuses_url":"https://api.github.com/repos/Avinash-barola/get2015/statuses/da477f80c616a4259212a89860094a06cfee7831","head":{"label":"Avinash-barola:AdvanceDS-avinash-assignment-1","ref":"AdvanceDS-avinash-assignment-1","sha":"da477f80c616a4259212a89860094a06cfee7831","user":{"login":"Avinash-barola","id":13676864,"avatar_url":"https://avatars.githubusercontent.com/u/13676864?v=3","gravatar_id":"","url":"https://api.github.com/users/Avinash-barola","html_url":"https://github.com/Avinash-barola","followers_url":"https://api.github.com/users/Avinash-barola/followers","following_url":"https://api.github.com/users/Avinash-barola/following{/other_user}","gists_url":"https://api.github.com/users/Avinash-barola/gists{/gist_id}","starred_url":"https://api.github.com/users/Avinash-barola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avinash-barola/subscriptions","organizations_url":"https://api.github.com/users/Avinash-barola/orgs","repos_url":"https://api.github.com/users/Avinash-barola/repos","events_url":"https://api.github.com/users/Avinash-barola/events{/privacy}","received_events_url":"https://api.github.com/users/Avinash-barola/received_events","type":"User","site_admin":false},"repo":{"id":40349639,"name":"get2015","full_name":"Avinash-barola/get2015","owner":{"login":"Avinash-barola","id":13676864,"avatar_url":"https://avatars.githubusercontent.com/u/13676864?v=3","gravatar_id":"","url":"https://api.github.com/users/Avinash-barola","html_url":"https://github.com/Avinash-barola","followers_url":"https://api.github.com/users/Avinash-barola/followers","following_url":"https://api.github.com/users/Avinash-barola/following{/other_user}","gists_url":"https://api.github.com/users/Avinash-barola/gists{/gist_id}","starred_url":"https://api.github.com/users/Avinash-barola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avinash-barola/subscriptions","organizations_url":"https://api.github.com/users/Avinash-barola/orgs","repos_url":"https://api.github.com/users/Avinash-barola/repos","events_url":"https://api.github.com/users/Avinash-barola/events{/privacy}","received_events_url":"https://api.github.com/users/Avinash-barola/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Avinash-barola/get2015","description":"Training repo for GET 2015 batch","fork":true,"url":"https://api.github.com/repos/Avinash-barola/get2015","forks_url":"https://api.github.com/repos/Avinash-barola/get2015/forks","keys_url":"https://api.github.com/repos/Avinash-barola/get2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Avinash-barola/get2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Avinash-barola/get2015/teams","hooks_url":"https://api.github.com/repos/Avinash-barola/get2015/hooks","issue_events_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/events{/number}","events_url":"https://api.github.com/repos/Avinash-barola/get2015/events","assignees_url":"https://api.github.com/repos/Avinash-barola/get2015/assignees{/user}","branches_url":"https://api.github.com/repos/Avinash-barola/get2015/branches{/branch}","tags_url":"https://api.github.com/repos/Avinash-barola/get2015/tags","blobs_url":"https://api.github.com/repos/Avinash-barola/get2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Avinash-barola/get2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Avinash-barola/get2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/Avinash-barola/get2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Avinash-barola/get2015/statuses/{sha}","languages_url":"https://api.github.com/repos/Avinash-barola/get2015/languages","stargazers_url":"https://api.github.com/repos/Avinash-barola/get2015/stargazers","contributors_url":"https://api.github.com/repos/Avinash-barola/get2015/contributors","subscribers_url":"https://api.github.com/repos/Avinash-barola/get2015/subscribers","subscription_url":"https://api.github.com/repos/Avinash-barola/get2015/subscription","commits_url":"https://api.github.com/repos/Avinash-barola/get2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/Avinash-barola/get2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/Avinash-barola/get2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/Avinash-barola/get2015/contents/{+path}","compare_url":"https://api.github.com/repos/Avinash-barola/get2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Avinash-barola/get2015/merges","archive_url":"https://api.github.com/repos/Avinash-barola/get2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Avinash-barola/get2015/downloads","issues_url":"https://api.github.com/repos/Avinash-barola/get2015/issues{/number}","pulls_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls{/number}","milestones_url":"https://api.github.com/repos/Avinash-barola/get2015/milestones{/number}","notifications_url":"https://api.github.com/repos/Avinash-barola/get2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Avinash-barola/get2015/labels{/name}","releases_url":"https://api.github.com/repos/Avinash-barola/get2015/releases{/id}","created_at":"2015-08-07T08:21:58Z","updated_at":"2015-08-25T13:01:24Z","pushed_at":"2015-11-23T10:10:29Z","git_url":"git://github.com/Avinash-barola/get2015.git","ssh_url":"git@github.com:Avinash-barola/get2015.git","clone_url":"https://github.com/Avinash-barola/get2015.git","svn_url":"https://github.com/Avinash-barola/get2015","homepage":null,"size":9034,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":47,"forks":1,"open_issues":47,"watchers":0,"default_branch":"master"}},"base":{"label":"Avinash-barola:master","ref":"master","sha":"67a74f895b944958d4a104604e6f0992e795cd40","user":{"login":"Avinash-barola","id":13676864,"avatar_url":"https://avatars.githubusercontent.com/u/13676864?v=3","gravatar_id":"","url":"https://api.github.com/users/Avinash-barola","html_url":"https://github.com/Avinash-barola","followers_url":"https://api.github.com/users/Avinash-barola/followers","following_url":"https://api.github.com/users/Avinash-barola/following{/other_user}","gists_url":"https://api.github.com/users/Avinash-barola/gists{/gist_id}","starred_url":"https://api.github.com/users/Avinash-barola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avinash-barola/subscriptions","organizations_url":"https://api.github.com/users/Avinash-barola/orgs","repos_url":"https://api.github.com/users/Avinash-barola/repos","events_url":"https://api.github.com/users/Avinash-barola/events{/privacy}","received_events_url":"https://api.github.com/users/Avinash-barola/received_events","type":"User","site_admin":false},"repo":{"id":40349639,"name":"get2015","full_name":"Avinash-barola/get2015","owner":{"login":"Avinash-barola","id":13676864,"avatar_url":"https://avatars.githubusercontent.com/u/13676864?v=3","gravatar_id":"","url":"https://api.github.com/users/Avinash-barola","html_url":"https://github.com/Avinash-barola","followers_url":"https://api.github.com/users/Avinash-barola/followers","following_url":"https://api.github.com/users/Avinash-barola/following{/other_user}","gists_url":"https://api.github.com/users/Avinash-barola/gists{/gist_id}","starred_url":"https://api.github.com/users/Avinash-barola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Avinash-barola/subscriptions","organizations_url":"https://api.github.com/users/Avinash-barola/orgs","repos_url":"https://api.github.com/users/Avinash-barola/repos","events_url":"https://api.github.com/users/Avinash-barola/events{/privacy}","received_events_url":"https://api.github.com/users/Avinash-barola/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Avinash-barola/get2015","description":"Training repo for GET 2015 batch","fork":true,"url":"https://api.github.com/repos/Avinash-barola/get2015","forks_url":"https://api.github.com/repos/Avinash-barola/get2015/forks","keys_url":"https://api.github.com/repos/Avinash-barola/get2015/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Avinash-barola/get2015/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Avinash-barola/get2015/teams","hooks_url":"https://api.github.com/repos/Avinash-barola/get2015/hooks","issue_events_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/events{/number}","events_url":"https://api.github.com/repos/Avinash-barola/get2015/events","assignees_url":"https://api.github.com/repos/Avinash-barola/get2015/assignees{/user}","branches_url":"https://api.github.com/repos/Avinash-barola/get2015/branches{/branch}","tags_url":"https://api.github.com/repos/Avinash-barola/get2015/tags","blobs_url":"https://api.github.com/repos/Avinash-barola/get2015/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Avinash-barola/get2015/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Avinash-barola/get2015/git/refs{/sha}","trees_url":"https://api.github.com/repos/Avinash-barola/get2015/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Avinash-barola/get2015/statuses/{sha}","languages_url":"https://api.github.com/repos/Avinash-barola/get2015/languages","stargazers_url":"https://api.github.com/repos/Avinash-barola/get2015/stargazers","contributors_url":"https://api.github.com/repos/Avinash-barola/get2015/contributors","subscribers_url":"https://api.github.com/repos/Avinash-barola/get2015/subscribers","subscription_url":"https://api.github.com/repos/Avinash-barola/get2015/subscription","commits_url":"https://api.github.com/repos/Avinash-barola/get2015/commits{/sha}","git_commits_url":"https://api.github.com/repos/Avinash-barola/get2015/git/commits{/sha}","comments_url":"https://api.github.com/repos/Avinash-barola/get2015/comments{/number}","issue_comment_url":"https://api.github.com/repos/Avinash-barola/get2015/issues/comments{/number}","contents_url":"https://api.github.com/repos/Avinash-barola/get2015/contents/{+path}","compare_url":"https://api.github.com/repos/Avinash-barola/get2015/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Avinash-barola/get2015/merges","archive_url":"https://api.github.com/repos/Avinash-barola/get2015/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Avinash-barola/get2015/downloads","issues_url":"https://api.github.com/repos/Avinash-barola/get2015/issues{/number}","pulls_url":"https://api.github.com/repos/Avinash-barola/get2015/pulls{/number}","milestones_url":"https://api.github.com/repos/Avinash-barola/get2015/milestones{/number}","notifications_url":"https://api.github.com/repos/Avinash-barola/get2015/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Avinash-barola/get2015/labels{/name}","releases_url":"https://api.github.com/repos/Avinash-barola/get2015/releases{/id}","created_at":"2015-08-07T08:21:58Z","updated_at":"2015-08-25T13:01:24Z","pushed_at":"2015-11-23T10:10:29Z","git_url":"git://github.com/Avinash-barola/get2015.git","ssh_url":"git@github.com:Avinash-barola/get2015.git","clone_url":"https://github.com/Avinash-barola/get2015.git","svn_url":"https://github.com/Avinash-barola/get2015","homepage":null,"size":9034,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":47,"forks":1,"open_issues":47,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35"},"html":{"href":"https://github.com/Avinash-barola/get2015/pull/35"},"issue":{"href":"https://api.github.com/repos/Avinash-barola/get2015/issues/35"},"comments":{"href":"https://api.github.com/repos/Avinash-barola/get2015/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Avinash-barola/get2015/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/Avinash-barola/get2015/statuses/da477f80c616a4259212a89860094a06cfee7831"}}}}