GitHub PullRequestReviewCommentEvent at 2014-08-28 08:03:06
Repository: neo4j
Actor: boggle
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/16825753","id":16825753,"diff_hunk":"@@ -0,0 +1,118 @@\n+/**\n+ * Copyright (c) 2002-2014 \"Neo Technology,\"\n+ * Network Engine for Objects in Lund AB [http://neotechnology.com]\n+ *\n+ * This file is part of Neo4j.\n+ *\n+ * Neo4j is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+package org.neo4j.cypher.internal.compiler.v2_2.planner\n+\n+import org.neo4j.cypher.InternalException\n+import org.neo4j.cypher.internal.compiler.v2_2._\n+\n+import scala.annotation.tailrec\n+\n+sealed trait RewriterStep\n+final case class NamedRewriter(name: String, rewriter: Rewriter) extends RewriterStep\n+final case class EnableRewriterCondition(cond: RewriterCondition) extends RewriterStep\n+final case class DisableRewriterCondition(cond: RewriterCondition) extends RewriterStep\n+case object NoRewriter extends RewriterStep\n+\n+object RewriterStep {\n+  implicit def namedProductRewriter(p: Product with Rewriter) = NamedRewriter(p.productPrefix, p)\n+  implicit def productRewriterCondition(p: Product with (AnyRef => Seq[String])) =  RewriterCondition(p.productPrefix, p)\n+  def enableCondition(p: Product with (AnyRef => Seq[String])) = EnableRewriterCondition(p)\n+  def disableCondition(p: Product with (AnyRef => Seq[String])) = DisableRewriterCondition(p)\n+}\n+\n+final case class RewriterCondition(name: String, condition: AnyRef => Seq[String]) {\n+  def apply(input: AnyRef): Option[RewriterConditionFailure] = {\n+    val problems = condition(input)\n+    if (problems.isEmpty) None else Some(RewriterConditionFailure(name, problems))\n+  }\n+}\n+\n+case class RewriterConditionFailure(name: String, problems: Seq[String])\n+\n+case class RewriterStepSequencer(sequenceName: String, rewriterWrapper: NamedRewriter => Rewriter = _.rewriter) {\n+  def apply(steps: RewriterStep*): Rewriter = inSequence(apply(steps.toList): _*)\n+\n+  def apply(steps: List[RewriterStep]): Seq[Rewriter] = {\n+    val tasks = buildTasks(Set.empty, None, steps, Seq.empty)\n+    val rewriters = tasks.map(taskRewriter)\n+    rewriters\n+  }\n+\n+  @tailrec\n+  private def buildTasks(\n+    currentConditions: Set[RewriterCondition],\n+    currentName: Option[String],\n+    input: List[RewriterStep],\n+    output: Seq[Either[(Option[String], Set[RewriterCondition]), NamedRewriter]]): Seq[Either[(Option[String], Set[RewriterCondition]), NamedRewriter]] =","path":"community/cypher/cypher-compiler-2.2/src/main/scala/org/neo4j/cypher/internal/compiler/v2_2/planner/RewriterStep.scala","position":63,"original_position":63,"commit_id":"b4597e6d430d3732d90e08ac66289d867e55d7ee","original_commit_id":"b4597e6d430d3732d90e08ac66289d867e55d7ee","user":{"login":"boggle","id":50886,"avatar_url":"https://avatars.githubusercontent.com/u/50886?v=2","gravatar_id":"475ca1c1637afa0d408cdcbf696c4148","url":"https://api.github.com/users/boggle","html_url":"https://github.com/boggle","followers_url":"https://api.github.com/users/boggle/followers","following_url":"https://api.github.com/users/boggle/following{/other_user}","gists_url":"https://api.github.com/users/boggle/gists{/gist_id}","starred_url":"https://api.github.com/users/boggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boggle/subscriptions","organizations_url":"https://api.github.com/users/boggle/orgs","repos_url":"https://api.github.com/users/boggle/repos","events_url":"https://api.github.com/users/boggle/events{/privacy}","received_events_url":"https://api.github.com/users/boggle/received_events","type":"User","site_admin":false},"body":"+1 was deferring that since the method is private and called it once place only. RunConditions and RunRewriter seem like good names, perhaps only defined local to this case class","created_at":"2014-08-28T08:03:06Z","updated_at":"2014-08-28T08:03:06Z","html_url":"https://github.com/neo4j/neo4j/pull/2924#discussion_r16825753","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/2924","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/16825753"},"html":{"href":"https://github.com/neo4j/neo4j/pull/2924#discussion_r16825753"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/2924"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/2924","id":20269345,"html_url":"https://github.com/neo4j/neo4j/pull/2924","diff_url":"https://github.com/neo4j/neo4j/pull/2924.diff","patch_url":"https://github.com/neo4j/neo4j/pull/2924.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/2924","number":2924,"state":"open","locked":false,"title":"Support for tracing ast rewriting and checking conditions","user":{"login":"boggle","id":50886,"avatar_url":"https://avatars.githubusercontent.com/u/50886?v=2","gravatar_id":"475ca1c1637afa0d408cdcbf696c4148","url":"https://api.github.com/users/boggle","html_url":"https://github.com/boggle","followers_url":"https://api.github.com/users/boggle/followers","following_url":"https://api.github.com/users/boggle/following{/other_user}","gists_url":"https://api.github.com/users/boggle/gists{/gist_id}","starred_url":"https://api.github.com/users/boggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boggle/subscriptions","organizations_url":"https://api.github.com/users/boggle/orgs","repos_url":"https://api.github.com/users/boggle/repos","events_url":"https://api.github.com/users/boggle/events{/privacy}","received_events_url":"https://api.github.com/users/boggle/received_events","type":"User","site_admin":false},"body":"o Condition checking still needs testing but the hot code path is tested","created_at":"2014-08-25T20:19:52Z","updated_at":"2014-08-28T08:03:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a400248ac1755bec820280835b7c15e76c55cd3d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/2924/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/2924/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/{number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/2924/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/b4597e6d430d3732d90e08ac66289d867e55d7ee","head":{"label":"boggle:ast-tracer","ref":"ast-tracer","sha":"b4597e6d430d3732d90e08ac66289d867e55d7ee","user":{"login":"boggle","id":50886,"avatar_url":"https://avatars.githubusercontent.com/u/50886?v=2","gravatar_id":"475ca1c1637afa0d408cdcbf696c4148","url":"https://api.github.com/users/boggle","html_url":"https://github.com/boggle","followers_url":"https://api.github.com/users/boggle/followers","following_url":"https://api.github.com/users/boggle/following{/other_user}","gists_url":"https://api.github.com/users/boggle/gists{/gist_id}","starred_url":"https://api.github.com/users/boggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boggle/subscriptions","organizations_url":"https://api.github.com/users/boggle/orgs","repos_url":"https://api.github.com/users/boggle/repos","events_url":"https://api.github.com/users/boggle/events{/privacy}","received_events_url":"https://api.github.com/users/boggle/received_events","type":"User","site_admin":false},"repo":{"id":7520917,"name":"neo4j","full_name":"boggle/neo4j","owner":{"login":"boggle","id":50886,"avatar_url":"https://avatars.githubusercontent.com/u/50886?v=2","gravatar_id":"475ca1c1637afa0d408cdcbf696c4148","url":"https://api.github.com/users/boggle","html_url":"https://github.com/boggle","followers_url":"https://api.github.com/users/boggle/followers","following_url":"https://api.github.com/users/boggle/following{/other_user}","gists_url":"https://api.github.com/users/boggle/gists{/gist_id}","starred_url":"https://api.github.com/users/boggle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boggle/subscriptions","organizations_url":"https://api.github.com/users/boggle/orgs","repos_url":"https://api.github.com/users/boggle/repos","events_url":"https://api.github.com/users/boggle/events{/privacy}","received_events_url":"https://api.github.com/users/boggle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/boggle/neo4j","description":"","fork":true,"url":"https://api.github.com/repos/boggle/neo4j","forks_url":"https://api.github.com/repos/boggle/neo4j/forks","keys_url":"https://api.github.com/repos/boggle/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/boggle/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/boggle/neo4j/teams","hooks_url":"https://api.github.com/repos/boggle/neo4j/hooks","issue_events_url":"https://api.github.com/repos/boggle/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/boggle/neo4j/events","assignees_url":"https://api.github.com/repos/boggle/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/boggle/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/boggle/neo4j/tags","blobs_url":"https://api.github.com/repos/boggle/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/boggle/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/boggle/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/boggle/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/boggle/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/boggle/neo4j/languages","stargazers_url":"https://api.github.com/repos/boggle/neo4j/stargazers","contributors_url":"https://api.github.com/repos/boggle/neo4j/contributors","subscribers_url":"https://api.github.com/repos/boggle/neo4j/subscribers","subscription_url":"https://api.github.com/repos/boggle/neo4j/subscription","commits_url":"https://api.github.com/repos/boggle/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/boggle/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/boggle/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/boggle/neo4j/issues/comments/{number}","contents_url":"https://api.github.com/repos/boggle/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/boggle/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/boggle/neo4j/merges","archive_url":"https://api.github.com/repos/boggle/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/boggle/neo4j/downloads","issues_url":"https://api.github.com/repos/boggle/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/boggle/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/boggle/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/boggle/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/boggle/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/boggle/neo4j/releases{/id}","created_at":"2013-01-09T12:50:34Z","updated_at":"2014-07-22T12:58:08Z","pushed_at":"2014-08-27T16:17:18Z","git_url":"git://github.com/boggle/neo4j.git","ssh_url":"git@github.com:boggle/neo4j.git","clone_url":"https://github.com/boggle/neo4j.git","svn_url":"https://github.com/boggle/neo4j","homepage":"http://neo4j.org","size":149118,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neo4j:master","ref":"master","sha":"6e42411e4929ade26c5fa359564e7b1a8786e903","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=2","gravatar_id":"1ecfef76afc397d0fb30b973e9508e41","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=2","gravatar_id":"1ecfef76afc397d0fb30b973e9508e41","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments/{number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","created_at":"2012-11-12T08:46:15Z","updated_at":"2014-08-28T04:02:33Z","pushed_at":"2014-08-27T22:41:47Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.org","size":340273,"stargazers_count":1040,"watchers_count":1040,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":476,"mirror_url":null,"open_issues_count":409,"forks":476,"open_issues":409,"watchers":1040,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/2924"},"html":{"href":"https://github.com/neo4j/neo4j/pull/2924"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/2924"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/2924/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/2924/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/2924/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/b4597e6d430d3732d90e08ac66289d867e55d7ee"}}}}