Permalink
Browse files

renaming shadowing ExecutionEngine-> ScalaExecutionEngine, ExecutionR…

…esult->ScalaExecutionResult
  • Loading branch information...
1 parent 03f92a3 commit d0513f5f088076358d2f07af13e39058eec4aaf0 @peterneubauer committed Aug 28, 2012
@@ -19,6 +19,7 @@
*/
package org.neo4j.cypher.javacompat;
+import org.neo4j.cypher.ScalaExecutionEngine;
import org.neo4j.cypher.SyntaxException;
import org.neo4j.cypher.internal.commands.Query;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -30,15 +31,15 @@
*/
public class ExecutionEngine
{
- private org.neo4j.cypher.ExecutionEngine inner;
+ private ScalaExecutionEngine inner;
/**
* Creates an execution engine around the give graph database
* @param database The database to wrap
*/
public ExecutionEngine( GraphDatabaseService database )
{
- inner = new org.neo4j.cypher.ExecutionEngine( database );
+ inner = new ScalaExecutionEngine( database );
}
/**
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.Map;
+import org.neo4j.cypher.ScalaExecutionResult;
+
/**
* Holds Cypher query result sets, in tabular form. Each row of the result is a map
* of column name to result object. Each column name correlates directly
@@ -39,7 +41,7 @@
*/
public class ExecutionResult implements Iterable<Map<String,Object>>
{
- private org.neo4j.cypher.ExecutionResult inner;
+ private ScalaExecutionResult inner;
/**
* Constructor used by the Cypher framework. End-users should not
@@ -48,7 +50,7 @@
*
* @param projection
*/
- public ExecutionResult( org.neo4j.cypher.ExecutionResult projection )
+ public ExecutionResult( ScalaExecutionResult projection )
{
inner = projection;
}
@@ -20,5 +20,5 @@
package org.neo4j.cypher
trait ExecutionPlan {
- def execute(params: Map[String,Any]): ExecutionResult
+ def execute(params: Map[String,Any]): ScalaExecutionResult
}
@@ -30,7 +30,7 @@ import collection.Map
import collection.immutable.{Map => ImmutableMap}
class PipeExecutionResult(r: => Traversable[Map[String, Any]], val symbols: SymbolTable, val columns: List[String])
- extends ExecutionResult
+ extends ScalaExecutionResult
with StringExtras
with IterableSupport {
@@ -29,7 +29,7 @@ import scala.deprecated
import org.neo4j.kernel.InternalAbstractGraphDatabase
import org.neo4j.graphdb.GraphDatabaseService
-class ExecutionEngine(graph: GraphDatabaseService) {
+class ScalaExecutionEngine(graph: GraphDatabaseService) {
checkScalaVersion()
require(graph != null, "Can't work with a null graph database")
@@ -49,28 +49,28 @@ class ExecutionEngine(graph: GraphDatabaseService) {
@throws(classOf[SyntaxException])
- def execute(query: String): ExecutionResult = execute(query, Map[String, Any]())
+ def execute(query: String): ScalaExecutionResult = execute(query, Map[String, Any]())
@throws(classOf[SyntaxException])
- def execute(query: String, params: Map[String, Any]): ExecutionResult = prepare(query).execute(params)
+ def execute(query: String, params: Map[String, Any]): ScalaExecutionResult = prepare(query).execute(params)
@throws(classOf[SyntaxException])
- def execute(query: String, params: JavaMap[String, Any]): ExecutionResult = execute(query, params.asScala.toMap)
+ def execute(query: String, params: JavaMap[String, Any]): ScalaExecutionResult = execute(query, params.asScala.toMap)
@throws(classOf[SyntaxException])
def prepare(query: String): ExecutionPlan = executionPlanCache.getOrElseUpdate(query, new ExecutionPlanImpl(parser.parse(query), graph))
@throws(classOf[SyntaxException])
@deprecated(message = "You should not parse queries manually any more. Use the execute(String) instead")
- def execute(query: Query): ExecutionResult = execute(query, Map[String, Any]())
+ def execute(query: Query): ScalaExecutionResult = execute(query, Map[String, Any]())
@throws(classOf[SyntaxException])
@deprecated(message = "You should not parse queries manually any more. Use the execute(String) instead")
- def execute(query: Query, map: JavaMap[String, Any]): ExecutionResult = execute(query, map.asScala.toMap)
+ def execute(query: Query, map: JavaMap[String, Any]): ScalaExecutionResult = execute(query, map.asScala.toMap)
@throws(classOf[SyntaxException])
@deprecated(message = "You should not parse queries manually any more. Use the execute(String) instead")
- def execute(query: Query, params: Map[String, Any]): ExecutionResult = new ExecutionPlanImpl(query, graph).execute(params)
+ def execute(query: Query, params: Map[String, Any]): ScalaExecutionResult = new ExecutionPlanImpl(query, graph).execute(params)
private def checkScalaVersion() {
if (util.Properties.versionString.matches("^version 2.9.0")) {
@@ -24,7 +24,7 @@ import java.lang.String
import internal.symbols.SymbolTable
-trait ExecutionResult extends Iterator[Map[String, Any]] {
+trait ScalaExecutionResult extends Iterator[Map[String, Any]] {
def columns: List[String]
def symbols: SymbolTable
def javaColumns: java.util.List[String]
@@ -31,9 +31,9 @@ import internal.symbols.SymbolTable
class ExecutionPlanImpl(inputQuery: Query, graph: GraphDatabaseService) extends ExecutionPlan {
val (executionPlan, executionPlanText) = prepareExecutionPlan()
- def execute(params: Map[String, Any]): ExecutionResult = executionPlan(params)
+ def execute(params: Map[String, Any]): ScalaExecutionResult = executionPlan(params)
- private def prepareExecutionPlan(): ((Map[String, Any]) => ExecutionResult, String) = {
+ private def prepareExecutionPlan(): ((Map[String, Any]) => ScalaExecutionResult, String) = {
var continue = true
var planInProgress = ExecutionPlanInProgress(PartiallySolvedQuery(inputQuery), new ParameterPipe(), false)
@@ -89,7 +89,7 @@ class ExecutionPlanImpl(inputQuery: Query, graph: GraphDatabaseService) extends
columns
}
- private def getLazyReadonlyQuery(pipe: Pipe, columns: List[String]): Map[String, Any] => ExecutionResult = {
+ private def getLazyReadonlyQuery(pipe: Pipe, columns: List[String]): Map[String, Any] => ScalaExecutionResult = {
val func = (params: Map[String, Any]) => {
val state = new QueryState(graph, MutableMaps.create ++ params)
new PipeExecutionResult(pipe.createResults(state), pipe.symbols, columns)
@@ -98,7 +98,7 @@ class ExecutionPlanImpl(inputQuery: Query, graph: GraphDatabaseService) extends
func
}
- private def getEagerReadWriteQuery(pipe: Pipe, columns: List[String]): Map[String, Any] => ExecutionResult = {
+ private def getEagerReadWriteQuery(pipe: Pipe, columns: List[String]): Map[String, Any] => ScalaExecutionResult = {
val func = (params: Map[String, Any]) => {
val state = new QueryState(graph, MutableMaps.create ++ params)
new EagerPipeExecutionResult(pipe.createResults(state), pipe.symbols, columns, state, graph)
@@ -46,8 +46,8 @@ class EagerVsLazyTests extends Assertions {
assertTrue("This should be eager", created)
}
- private def execute(query: String): ExecutionResult = {
- val engine = new ExecutionEngine(graph)
+ private def execute(query: String): ScalaExecutionResult = {
+ val engine = new ScalaExecutionEngine(graph)
engine.execute(query)
}
@@ -25,11 +25,11 @@ import org.junit.Before
trait ExecutionEngineHelper extends GraphDatabaseTestBase {
- var engine: ExecutionEngine = null
+ var engine: ScalaExecutionEngine = null
@Before
def executionEngineHelperInit() {
- engine = new ExecutionEngine(graph)
+ engine = new ScalaExecutionEngine(graph)
}
def execute(query: Query, params:(String,Any)*) = {
@@ -38,7 +38,7 @@ trait ExecutionEngineHelper extends GraphDatabaseTestBase {
}
- def parseAndExecute(q: String, params: (String, Any)*): ExecutionResult = {
+ def parseAndExecute(q: String, params: (String, Any)*): ScalaExecutionResult = {
val plan = engine.prepare(q)
plan.execute(params.toMap)
@@ -1224,7 +1224,7 @@ return a""")
@Test def shouldSupportColumnRenaming() {
val a = createNode(Map("name" -> "Andreas"))
- val result: ExecutionResult = parseAndExecute( """
+ val result: ScalaExecutionResult = parseAndExecute( """
start a = node(1)
return a as OneLove""")
@@ -1828,7 +1828,7 @@ RETURN x0.name?
@Test def createEngineWithSpecifiedParserVersion() {
val db = new ImpermanentGraphDatabase(Map[String, String]("cypher_parser_version" -> "1.6").asJava)
- val engine = new ExecutionEngine(db)
+ val engine = new ScalaExecutionEngine(db)
try {
// This syntax is valid today, but should give an exception in 1.5
@@ -512,7 +512,7 @@ return distinct center""")
}
}
trait StatisticsChecker extends Assertions {
- def assertStats(result: ExecutionResult,
+ def assertStats(result: ScalaExecutionResult,
nodesCreated: Long = 0,
relationshipsCreated: Long = 0,
propertiesSet: Long = 0,
@@ -38,7 +38,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
var db: GraphDatabaseService = null
val parser: CypherParser = new CypherParser
- implicit var engine: ExecutionEngine = null
+ implicit var engine: ScalaExecutionEngine = null
var nodes: Map[String, Long] = null
var nodeIndex: Index[Node] = null
var relIndex: Index[Relationship] = null
@@ -47,11 +47,11 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
def title: String
def section: String
- def assert(name: String, result: ExecutionResult)
+ def assert(name: String, result: ScalaExecutionResult)
def graphDescription: List[String]
def indexProps: List[String] = List()
- def executeQuery(queryText: String)(implicit engine: ExecutionEngine): ExecutionResult = try {
+ def executeQuery(queryText: String)(implicit engine: ScalaExecutionEngine): ScalaExecutionResult = try {
val result = engine.execute(replaceNodeIds(queryText))
result.toList //Let's materialize the result
result.dumpToString()
@@ -66,7 +66,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
query
}
- def testWithoutDocs(queryText: String, assertions: (ExecutionResult => Unit)*): (ExecutionResult, String) = {
+ def testWithoutDocs(queryText: String, assertions: (ScalaExecutionResult => Unit)*): (ScalaExecutionResult, String) = {
var query = queryText
nodes.keySet.foreach((key) => query = query.replace("%" + key + "%", node(key).getId.toString))
val result = engine.execute(query)
@@ -116,7 +116,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
def runQuery(emptyGraph: Boolean, query: String, possibleAssertion: Seq[String]): String = {
val result = if (emptyGraph) {
val db = new ImpermanentGraphDatabase()
- val engine = new ExecutionEngine(db)
+ val engine = new ScalaExecutionEngine(db)
val result = executeQuery(query)(engine)
db.shutdown()
result
@@ -227,7 +227,7 @@ abstract class ArticleTest extends Assertions with DocumentationHelper {
n._2.foreach((kv) => nod.setProperty(kv._1, kv._2))
})
})
- engine = new ExecutionEngine(db)
+ engine = new ScalaExecutionEngine(db)
db
}
}
@@ -31,7 +31,7 @@ import org.neo4j.walk.Walker
import org.neo4j.visualization.asciidoc.AsciidocHelper
import org.neo4j.cypher.CuteGraphDatabaseService.gds2cuteGds
import org.neo4j.cypher.javacompat.GraphImpl
-import org.neo4j.cypher.{CypherParser, ExecutionResult, ExecutionEngine}
+import org.neo4j.cypher.{CypherParser, ScalaExecutionResult, ScalaExecutionEngine}
import org.neo4j.test.{ImpermanentGraphDatabase, TestGraphDatabaseFactory, GraphDescription}
import org.neo4j.test.GeoffService
import org.scalatest.Assertions
@@ -86,9 +86,9 @@ _Graph_
}
abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
- def testQuery(title: String, text: String, queryText: String, returns: String, assertions: (ExecutionResult => Unit)*) {
+ def testQuery(title: String, text: String, queryText: String, returns: String, assertions: (ScalaExecutionResult => Unit)*) {
val r = testWithoutDocs(queryText, assertions:_*)
- val result: ExecutionResult = r._1
+ val result: ScalaExecutionResult = r._1
var query: String = r._2
val (dir: File, writer: PrintWriter) = createWriter(title, section)
@@ -99,7 +99,7 @@ abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
var db: GraphDatabaseService = null
val parser: CypherParser = new CypherParser
- var engine: ExecutionEngine = null
+ var engine: ScalaExecutionEngine = null
var nodes: Map[String, Long] = null
var nodeIndex: Index[Node] = null
var relIndex: Index[Relationship] = null
@@ -115,7 +115,7 @@ abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
def indexProps: List[String] = List()
- def dumpToFile(writer: PrintWriter, title: String, query: String, returns: String, text: String, result: ExecutionResult) {
+ def dumpToFile(writer: PrintWriter, title: String, query: String, returns: String, text: String, result: ScalaExecutionResult) {
writer.println("[[" + nicefy(section + " " + title) + "]]")
if (!noTitle) writer.println("== " + title + " ==")
writer.println(text)
@@ -125,15 +125,15 @@ abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
writer.close()
}
- def executeQuery(queryText: String): ExecutionResult = {
+ def executeQuery(queryText: String): ScalaExecutionResult = {
var query = queryText
nodes.keySet.foreach((key) => query = query.replace("%" + key + "%", node(key).getId.toString))
engine.execute(query)
}
- def testWithoutDocs(queryText: String, assertions: (ExecutionResult => Unit)*): (ExecutionResult, String) = {
+ def testWithoutDocs(queryText: String, assertions: (ScalaExecutionResult => Unit)*): (ScalaExecutionResult, String) = {
var query = queryText
nodes.keySet.foreach((key) => query = query.replace("%" + key + "%", node(key).getId.toString))
val result = engine.execute(query)
@@ -165,7 +165,7 @@ abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
setConfig( GraphDatabaseSettings.node_keys_indexable, "name" ).
setConfig( GraphDatabaseSettings.node_auto_indexing, GraphDatabaseSetting.TRUE ).
newGraphDatabase()
- engine = new ExecutionEngine(db)
+ engine = new ScalaExecutionEngine(db)
db.asInstanceOf[ImpermanentGraphDatabase].cleanContent(false)
@@ -191,7 +191,7 @@ abstract class DocumentingTestBase extends Assertions with DocumentationHelper {
})
}
- def runQuery(writer: PrintWriter, query: String, returns: String, result: ExecutionResult) {
+ def runQuery(writer: PrintWriter, query: String, returns: String, result: ScalaExecutionResult) {
writer.println("_Query_")
writer.println()
writer.println(AsciidocHelper.createCypherSnippet(query))
@@ -22,8 +22,9 @@ package org.neo4j.cypher.docgen
import org.junit.Test
import org.junit.Assert._
import org.neo4j.graphdb.Node
-import org.neo4j.cypher.ExecutionResult
+import org.neo4j.cypher.ScalaExecutionResult
import collection.mutable.WrappedArray
+import org.neo4j.cypher.ScalaExecutionEngine
class FunctionsTest extends DocumentingTestBase {
def graphDescription = List("A KNOWS B", "A KNOWS C", "B KNOWS D", "C KNOWS D", "B MARRIED E")
@@ -298,7 +299,7 @@ class FunctionsTest extends DocumentingTestBase {
)) === p.toList)
)
}
- private def testThis(title: String, syntax: String, arguments: List[(String, String)], text: String, queryText: String, returns: String, assertions: (ExecutionResult => Unit)*) {
+ private def testThis(title: String, syntax: String, arguments: List[(String, String)], text: String, queryText: String, returns: String, assertions: (ScalaExecutionResult => Unit)*) {
val argsText = arguments.map(x => "* _" + x._1 + ":_ " + x._2).mkString("\r\n\r\n")
val fullText = String.format("""%s
@@ -19,13 +19,14 @@
*/
package org.neo4j.cypher.docgen
-import org.neo4j.cypher.ExecutionResult
+import org.neo4j.cypher.ScalaExecutionResult
+
class PatternTest extends ArticleTest {
override val indexProps: List[String] = List("name")
- def assert(name: String, result: ExecutionResult) {}
+ def assert(name: String, result: ScalaExecutionResult) {}
val graphDescription = List("A KNOWS B", "A KNOWS C", "A KNOWS D", "B KNOWS E", "C KNOWS E", "D KNOWS F")
@@ -20,7 +20,7 @@
package org.neo4j.cypher.docgen.cookbook
import org.neo4j.cypher.docgen.ArticleTest
-import org.neo4j.cypher.{ExecutionResult, StatisticsChecker}
+import org.neo4j.cypher.{ScalaExecutionResult, StatisticsChecker}
import org.neo4j.visualization.graphviz.GraphStyle
import org.neo4j.visualization.graphviz.AsciiDocSimpleStyle
@@ -32,7 +32,7 @@ class LinkedListTest extends ArticleTest with StatisticsChecker {
override protected def getGraphvizStyle: GraphStyle =
AsciiDocSimpleStyle.withAutomaticRelationshipTypeColors()
- override def assert(name: String, result: ExecutionResult) {
+ override def assert(name: String, result: ScalaExecutionResult) {
name match {
case "create" =>
assertStats(result, nodesCreated = 1, relationshipsCreated = 1, propertiesSet = 0)
Oops, something went wrong.

0 comments on commit d0513f5

Please sign in to comment.