{"action":"created","comment":{"url":"https://api.github.com/repos/ambiata/ivory/pulls/comments/22445993","id":22445993,"diff_hunk":"@@ -0,0 +1,44 @@\n+package com.ambiata.ivory.operation.extraction.reduction\n+\n+import com.ambiata.ivory.core._\n+import org.specs2.{ScalaCheck, Specification}\n+import com.ambiata.ivory.core.thrift.ThriftFactValue\n+\n+\n+class InverseReducerSpec extends Specification with ScalaCheck { def is = s2\"\"\"\n+  Inverse count reducer works with doubles       $inverseDouble\n+  Inverse count reducer works with ints          $inverseInt\n+\n+\"\"\"\n+\n+  def inverseDouble = prop((number: Double) => {    \n+    val r = new InverseReducer(new DummyDoubleReducer(number))\n+    r.save ==== ThriftFactValue.d(if (number == 0.0) Double.NaN else 1.0 / number) \n+  })\n+\n+  def inverseInt = prop((number: Int) => {    \n+    val r = new InverseReducer(new DummyIntReducer(number))\n+    r.save ==== ThriftFactValue.d(if (number == 0) Double.NaN else 1.0 / number) \n+  })\n+\n+  class DummyDoubleReducer(ret: Double) extends Reduction {\n+    val value = new ThriftFactValue()\n+    def clear(): Unit = ()\n+    def update(f: Fact): Unit = ()\n+    def skip(f: Fact, reason: String): Unit = ()\n+    def save: ThriftFactValue = {\n+      value.setD(ret)\n+      value\n+    }\n+  }\n+  class DummyIntReducer(ret: Int) extends Reduction {\n+    val value = new ThriftFactValue()\n+    def clear(): Unit = ()\n+    def update(f: Fact): Unit = ()\n+    def skip(f: Fact, reason: String): Unit = ()\n+    def save: ThriftFactValue = {\n+      value.setI(ret)","path":"ivory-operation/src/test/scala/com/ambiata/ivory/operation/extraction/reduction/InverseReducerSpec.scala","position":40,"original_position":40,"commit_id":"4c520312376482ad8cdbc5869f3c773d3199b4a9","original_commit_id":"4c520312376482ad8cdbc5869f3c773d3199b4a9","user":{"login":"FrontierOtr","id":5205457,"avatar_url":"https://avatars.githubusercontent.com/u/5205457?v=3","gravatar_id":"","url":"https://api.github.com/users/FrontierOtr","html_url":"https://github.com/FrontierOtr","followers_url":"https://api.github.com/users/FrontierOtr/followers","following_url":"https://api.github.com/users/FrontierOtr/following{/other_user}","gists_url":"https://api.github.com/users/FrontierOtr/gists{/gist_id}","starred_url":"https://api.github.com/users/FrontierOtr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrontierOtr/subscriptions","organizations_url":"https://api.github.com/users/FrontierOtr/orgs","repos_url":"https://api.github.com/users/FrontierOtr/repos","events_url":"https://api.github.com/users/FrontierOtr/events{/privacy}","received_events_url":"https://api.github.com/users/FrontierOtr/received_events","type":"User","site_admin":false},"body":"Indeed","created_at":"2015-01-05T02:35:00Z","updated_at":"2015-01-05T02:35:00Z","html_url":"https://github.com/ambiata/ivory/pull/532#discussion_r22445993","pull_request_url":"https://api.github.com/repos/ambiata/ivory/pulls/532","_links":{"self":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/comments/22445993"},"html":{"href":"https://github.com/ambiata/ivory/pull/532#discussion_r22445993"},"pull_request":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/532"}}},"pull_request":{"url":"https://api.github.com/repos/ambiata/ivory/pulls/532","id":26281180,"html_url":"https://github.com/ambiata/ivory/pull/532","diff_url":"https://github.com/ambiata/ivory/pull/532.diff","patch_url":"https://github.com/ambiata/ivory/pull/532.patch","issue_url":"https://api.github.com/repos/ambiata/ivory/issues/532","number":532,"state":"open","locked":false,"title":"Topic/latest nreducer","user":{"login":"FrontierOtr","id":5205457,"avatar_url":"https://avatars.githubusercontent.com/u/5205457?v=3","gravatar_id":"","url":"https://api.github.com/users/FrontierOtr","html_url":"https://github.com/FrontierOtr","followers_url":"https://api.github.com/users/FrontierOtr/followers","following_url":"https://api.github.com/users/FrontierOtr/following{/other_user}","gists_url":"https://api.github.com/users/FrontierOtr/gists{/gist_id}","starred_url":"https://api.github.com/users/FrontierOtr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FrontierOtr/subscriptions","organizations_url":"https://api.github.com/users/FrontierOtr/orgs","repos_url":"https://api.github.com/users/FrontierOtr/repos","events_url":"https://api.github.com/users/FrontierOtr/events{/privacy}","received_events_url":"https://api.github.com/users/FrontierOtr/received_events","type":"User","site_admin":false},"body":"WIP","created_at":"2014-12-18T07:01:58Z","updated_at":"2015-01-05T02:35:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cdb79ede2e2b66b0099f89bfff13e6dcd15be29","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ambiata/ivory/pulls/532/commits","review_comments_url":"https://api.github.com/repos/ambiata/ivory/pulls/532/comments","review_comment_url":"https://api.github.com/repos/ambiata/ivory/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ambiata/ivory/issues/532/comments","statuses_url":"https://api.github.com/repos/ambiata/ivory/statuses/4c520312376482ad8cdbc5869f3c773d3199b4a9","head":{"label":"ambiata:topic/latestNreducer","ref":"topic/latestNreducer","sha":"4c520312376482ad8cdbc5869f3c773d3199b4a9","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":18756054,"name":"ivory","full_name":"ambiata/ivory","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/ivory","description":"A scalable and extensible data store for storing facts and extracting features.","fork":false,"url":"https://api.github.com/repos/ambiata/ivory","forks_url":"https://api.github.com/repos/ambiata/ivory/forks","keys_url":"https://api.github.com/repos/ambiata/ivory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/ivory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/ivory/teams","hooks_url":"https://api.github.com/repos/ambiata/ivory/hooks","issue_events_url":"https://api.github.com/repos/ambiata/ivory/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/ivory/events","assignees_url":"https://api.github.com/repos/ambiata/ivory/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/ivory/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/ivory/tags","blobs_url":"https://api.github.com/repos/ambiata/ivory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/ivory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/ivory/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/ivory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/ivory/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/ivory/languages","stargazers_url":"https://api.github.com/repos/ambiata/ivory/stargazers","contributors_url":"https://api.github.com/repos/ambiata/ivory/contributors","subscribers_url":"https://api.github.com/repos/ambiata/ivory/subscribers","subscription_url":"https://api.github.com/repos/ambiata/ivory/subscription","commits_url":"https://api.github.com/repos/ambiata/ivory/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/ivory/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/ivory/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/ivory/issues/comments/{number}","contents_url":"https://api.github.com/repos/ambiata/ivory/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/ivory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/ivory/merges","archive_url":"https://api.github.com/repos/ambiata/ivory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/ivory/downloads","issues_url":"https://api.github.com/repos/ambiata/ivory/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/ivory/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/ivory/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/ivory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/ivory/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/ivory/releases{/id}","created_at":"2014-04-14T09:54:53Z","updated_at":"2014-12-31T18:18:45Z","pushed_at":"2015-01-05T02:32:50Z","git_url":"git://github.com/ambiata/ivory.git","ssh_url":"git@github.com:ambiata/ivory.git","clone_url":"https://github.com/ambiata/ivory.git","svn_url":"https://github.com/ambiata/ivory","homepage":"","size":11806,"stargazers_count":30,"watchers_count":30,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":113,"forks":3,"open_issues":113,"watchers":30,"default_branch":"master"}},"base":{"label":"ambiata:master","ref":"master","sha":"c10f1666e78ec6227d0c576337ba021869785cfa","user":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"repo":{"id":18756054,"name":"ivory","full_name":"ambiata/ivory","owner":{"login":"ambiata","id":1691023,"avatar_url":"https://avatars.githubusercontent.com/u/1691023?v=3","gravatar_id":"","url":"https://api.github.com/users/ambiata","html_url":"https://github.com/ambiata","followers_url":"https://api.github.com/users/ambiata/followers","following_url":"https://api.github.com/users/ambiata/following{/other_user}","gists_url":"https://api.github.com/users/ambiata/gists{/gist_id}","starred_url":"https://api.github.com/users/ambiata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ambiata/subscriptions","organizations_url":"https://api.github.com/users/ambiata/orgs","repos_url":"https://api.github.com/users/ambiata/repos","events_url":"https://api.github.com/users/ambiata/events{/privacy}","received_events_url":"https://api.github.com/users/ambiata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ambiata/ivory","description":"A scalable and extensible data store for storing facts and extracting features.","fork":false,"url":"https://api.github.com/repos/ambiata/ivory","forks_url":"https://api.github.com/repos/ambiata/ivory/forks","keys_url":"https://api.github.com/repos/ambiata/ivory/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ambiata/ivory/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ambiata/ivory/teams","hooks_url":"https://api.github.com/repos/ambiata/ivory/hooks","issue_events_url":"https://api.github.com/repos/ambiata/ivory/issues/events{/number}","events_url":"https://api.github.com/repos/ambiata/ivory/events","assignees_url":"https://api.github.com/repos/ambiata/ivory/assignees{/user}","branches_url":"https://api.github.com/repos/ambiata/ivory/branches{/branch}","tags_url":"https://api.github.com/repos/ambiata/ivory/tags","blobs_url":"https://api.github.com/repos/ambiata/ivory/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ambiata/ivory/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ambiata/ivory/git/refs{/sha}","trees_url":"https://api.github.com/repos/ambiata/ivory/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ambiata/ivory/statuses/{sha}","languages_url":"https://api.github.com/repos/ambiata/ivory/languages","stargazers_url":"https://api.github.com/repos/ambiata/ivory/stargazers","contributors_url":"https://api.github.com/repos/ambiata/ivory/contributors","subscribers_url":"https://api.github.com/repos/ambiata/ivory/subscribers","subscription_url":"https://api.github.com/repos/ambiata/ivory/subscription","commits_url":"https://api.github.com/repos/ambiata/ivory/commits{/sha}","git_commits_url":"https://api.github.com/repos/ambiata/ivory/git/commits{/sha}","comments_url":"https://api.github.com/repos/ambiata/ivory/comments{/number}","issue_comment_url":"https://api.github.com/repos/ambiata/ivory/issues/comments/{number}","contents_url":"https://api.github.com/repos/ambiata/ivory/contents/{+path}","compare_url":"https://api.github.com/repos/ambiata/ivory/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ambiata/ivory/merges","archive_url":"https://api.github.com/repos/ambiata/ivory/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ambiata/ivory/downloads","issues_url":"https://api.github.com/repos/ambiata/ivory/issues{/number}","pulls_url":"https://api.github.com/repos/ambiata/ivory/pulls{/number}","milestones_url":"https://api.github.com/repos/ambiata/ivory/milestones{/number}","notifications_url":"https://api.github.com/repos/ambiata/ivory/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ambiata/ivory/labels{/name}","releases_url":"https://api.github.com/repos/ambiata/ivory/releases{/id}","created_at":"2014-04-14T09:54:53Z","updated_at":"2014-12-31T18:18:45Z","pushed_at":"2015-01-05T02:32:50Z","git_url":"git://github.com/ambiata/ivory.git","ssh_url":"git@github.com:ambiata/ivory.git","clone_url":"https://github.com/ambiata/ivory.git","svn_url":"https://github.com/ambiata/ivory","homepage":"","size":11806,"stargazers_count":30,"watchers_count":30,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":113,"forks":3,"open_issues":113,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/532"},"html":{"href":"https://github.com/ambiata/ivory/pull/532"},"issue":{"href":"https://api.github.com/repos/ambiata/ivory/issues/532"},"comments":{"href":"https://api.github.com/repos/ambiata/ivory/issues/532/comments"},"review_comments":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/532/comments"},"review_comment":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ambiata/ivory/pulls/532/commits"},"statuses":{"href":"https://api.github.com/repos/ambiata/ivory/statuses/4c520312376482ad8cdbc5869f3c773d3199b4a9"}}}}