You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2021/07/21 14:02:43 UTC
[tinkerpop] branch TINKERPOP-2582 updated: wip
This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch TINKERPOP-2582
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/TINKERPOP-2582 by this push:
new 9318b4b wip
9318b4b is described below
commit 9318b4bf2dd2ad307d9f29e16b577aa57ddbde0c
Author: Stephen Mallette <st...@amazon.com>
AuthorDate: Wed Jul 21 09:22:53 2021 -0400
wip
---
.../language/grammar/GenericLiteralVisitor.java | 2 +-
.../grammar/GraphTraversalSourceVisitor.java | 10 +-
.../language/grammar/GremlinAntlrToJava.java | 46 +-
.../language/grammar/GremlinErrorListener.java | 2 +-
.../language/grammar/GremlinParserException.java | 2 +-
.../language/grammar/GremlinQueryParser.java | 1 -
.../grammar/GremlinStringConstantsVisitor.java | 3 +-
.../grammar/NestedTraversalSourceListVisitor.java | 5 +-
.../language/grammar/NoOpTerminalVisitor.java | 18 +-
.../grammar/TerminalMethodToBytecodeVisitor.java | 4 +
.../language/grammar/TraversalEnumParser.java | 14 +-
.../language/grammar/TraversalFunctionVisitor.java | 1 -
.../language/grammar/TraversalMethodVisitor.java | 574 +++++++--------------
.../grammar/TraversalPredicateVisitor.java | 3 -
.../language/grammar/TraversalRootVisitor.java | 9 +-
.../grammar/TraversalSourceSelfMethodVisitor.java | 2 +-
.../grammar/TraversalSourceSpawnMethodVisitor.java | 29 +-
.../gremlin-javascript/package-lock.json | 22 +-
18 files changed, 290 insertions(+), 457 deletions(-)
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GenericLiteralVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GenericLiteralVisitor.java
index 07ba642..92b7a0a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GenericLiteralVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GenericLiteralVisitor.java
@@ -473,7 +473,7 @@ public class GenericLiteralVisitor extends GremlinBaseVisitor<Object> {
/**
* {@inheritDoc}
- * Generic literal collection returns a list of Object
+ * Generic literal collection returns a list of {@code Object}
*/
@Override
public Object visitGenericLiteralCollection(final GremlinParser.GenericLiteralCollectionContext ctx) {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GraphTraversalSourceVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GraphTraversalSourceVisitor.java
index be36136..6d44337 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GraphTraversalSourceVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GraphTraversalSourceVisitor.java
@@ -22,16 +22,22 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
import org.apache.tinkerpop.gremlin.structure.Graph;
/**
- * This class implements the GraphTraversalSource producing methods of Gremlin grammar.
+ * This class implements the {@link GraphTraversalSource} producing methods of Gremlin grammar.
*/
public class GraphTraversalSourceVisitor extends GremlinBaseVisitor<GraphTraversalSource> {
public static final String TRAVERSAL_ROOT = "g";
private final Graph graph;
private final GremlinAntlrToJava antlr;
+ private final String traversalSourceName;
public GraphTraversalSourceVisitor(final GremlinAntlrToJava antlr) {
+ this(TRAVERSAL_ROOT, antlr);
+ }
+
+ public GraphTraversalSourceVisitor(final String traversalSourceName, final GremlinAntlrToJava antlr) {
this.graph = antlr.graph;
this.antlr = antlr;
+ this.traversalSourceName = traversalSourceName;
}
/**
@@ -45,7 +51,7 @@ public class GraphTraversalSourceVisitor extends GremlinBaseVisitor<GraphTravers
} else {
final int childIndexOfSelfMethod = 2;
GraphTraversalSource source;
- if (ctx.getChild(0).getText().equals(TRAVERSAL_ROOT)) {
+ if (ctx.getChild(0).getText().equals(traversalSourceName)) {
// handle single traversal source
source = graph.traversal();
} else {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinAntlrToJava.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinAntlrToJava.java
index 7629a41..cb3afff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinAntlrToJava.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinAntlrToJava.java
@@ -22,6 +22,7 @@ import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -53,21 +54,30 @@ public class GremlinAntlrToJava extends GremlinBaseVisitor<Object> {
*/
final GremlinBaseVisitor<GraphTraversal> tvisitor;
- final GremlinBaseVisitor<Traversal[]> anonymousListVisitor;
+ /**
+ * A {@link GremlinBaseVisitor} that is meant to construct a list of traversals anonymously.
+ */
+ final GremlinBaseVisitor<Traversal[]> tListVisitor;
- final Supplier<GraphTraversal> createAnonymous;
+ /**
+ * Creates a {@link GraphTraversal} implementation that is meant to be anonymous. This provides a way to change the
+ * type of implementation that will be used as anonymous traversals. By default, it uses {@link __} which generates
+ * a {@link DefaultGraphTraversal}
+ */
+ final Supplier<GraphTraversal<?,?>> createAnonymous;
/**
* Constructs a new instance and is bound to an {@link EmptyGraph}. This form of construction is helpful for
* generating {@link Bytecode} or for various forms of testing. {@link Traversal} instances constructed from this
- * form will not be capable of iterating.
+ * form will not be capable of iterating. Assumes that "g" is the name of the {@link GraphTraversalSource}.
*/
public GremlinAntlrToJava() {
this(EmptyGraph.instance());
}
/**
- * Constructs a new instance that is bound to the specified {@link Graph} instance.
+ * Constructs a new instance that is bound to the specified {@link Graph} instance. Assumes that "g" is the name
+ * of the {@link GraphTraversalSource}.
*/
public GremlinAntlrToJava(final Graph graph) {
this(graph, __::start);
@@ -75,13 +85,26 @@ public class GremlinAntlrToJava extends GremlinBaseVisitor<Object> {
/**
* Constructs a new instance that is bound to the specified {@link Graph} instance with an override to using
+ * {@link __} for constructing anonymous {@link Traversal} instances. Assumes that "g" is the name of the
+ * {@link GraphTraversalSource}.
+ */
+ protected GremlinAntlrToJava(final Graph graph, final Supplier<GraphTraversal<?,?>> createAnonymous) {
+ this(GraphTraversalSourceVisitor.TRAVERSAL_ROOT, graph, createAnonymous);
+ }
+
+ /**
+ * Constructs a new instance that is bound to the specified {@link Graph} instance with an override to using
* {@link __} for constructing anonymous {@link Traversal} instances.
+ *
+ * @param traversalSourceName The name of the traversal source which will be "g" if not specified.
*/
- protected GremlinAntlrToJava(final Graph graph, final Supplier<GraphTraversal> createAnonymous) {
+ protected GremlinAntlrToJava(final String traversalSourceName, final Graph graph,
+ final Supplier<GraphTraversal<?,?>> createAnonymous) {
this.graph = graph;
- this.gvisitor = new GraphTraversalSourceVisitor(this);
+ this.gvisitor = new GraphTraversalSourceVisitor(
+ null == traversalSourceName ? GraphTraversalSourceVisitor.TRAVERSAL_ROOT : traversalSourceName,this);
this.tvisitor = new TraversalRootVisitor(this);
- this.anonymousListVisitor = new NestedTraversalSourceListVisitor(this);
+ this.tListVisitor = new NestedTraversalSourceListVisitor(this);
this.createAnonymous = createAnonymous;
}
@@ -130,11 +153,10 @@ public class GremlinAntlrToJava extends GremlinBaseVisitor<Object> {
}
/**
- * Override the aggregate result behavior.
- * If the next Result is null, return the current result.
- * This is used to handle child EOF, which is the last child of the QueryList context.
- * If the next Result is not null, return the next result.
- * This is used to handle multiple queries, and return only the last query result logic.
+ * Override the aggregate result behavior. If the next result is {@code null}, return the current result. This is
+ * used to handle child EOF, which is the last child of the {@code QueryList} context. If the next Result is not
+ * {@code null}, return the next result. This is used to handle multiple queries, and return only the last query
+ * result logic.
*/
@Override
protected Object aggregateResult(final Object result, final Object nextResult) {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinErrorListener.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinErrorListener.java
index 53007a9..4b19fbc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinErrorListener.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinErrorListener.java
@@ -23,7 +23,7 @@ import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
/**
- * Gremlin error listener class which throw GremlinParserException on syntax error
+ * Gremlin error listener class which throw {@link GremlinParserException} on syntax error.
*/
public class GremlinErrorListener extends BaseErrorListener {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinParserException.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinParserException.java
index 047c4b9..946e715 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinParserException.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinParserException.java
@@ -19,7 +19,7 @@
package org.apache.tinkerpop.gremlin.language.grammar;
/**
- * Gremlin Parser Exception is thrown when a parser error is encountered.
+ * This exception is thrown when a parser error is encountered.
*/
public class GremlinParserException extends RuntimeException {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinQueryParser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinQueryParser.java
index eb7397f..49a3469 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinQueryParser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinQueryParser.java
@@ -29,7 +29,6 @@ public class GremlinQueryParser {
private static final Logger log = LoggerFactory.getLogger(GremlinQueryParser.class);
private static final GremlinErrorListener errorListener = new GremlinErrorListener();
- // todo: cleanup exception
public static Object parse(final String query) throws Exception {
return parse(query, new GremlinAntlrToJava());
}
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinStringConstantsVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinStringConstantsVisitor.java
index 95a35e9..307cee9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinStringConstantsVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinStringConstantsVisitor.java
@@ -21,10 +21,11 @@ package org.apache.tinkerpop.gremlin.language.grammar;
import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRank;
import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressure;
import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ShortestPath;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.WithOptions;
/**
- * Gremlin String Constant Visitor handles parsing the new constant types Gremlin introduced by version 3.4.0.
+ * Covers {@code String} oriented constants used as arguments to {@link GraphTraversal#with(String)} steps.
*/
public class GremlinStringConstantsVisitor extends GremlinBaseVisitor<Object> {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NestedTraversalSourceListVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NestedTraversalSourceListVisitor.java
index 41d44e8..f621900 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NestedTraversalSourceListVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NestedTraversalSourceListVisitor.java
@@ -21,9 +21,8 @@ package org.apache.tinkerpop.gremlin.language.grammar;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
/**
- * This class implements gremlin grammar's nested-traversal-list methods
- * that returns a Traversal [] to the callers. It doesn't depend on a GraphTraversal and hence a singleton class.
- * As it is stateless, we use singleton to avoid object creation/deletion
+ * This class implements Gremlin grammar's nested-traversal-list methods that returns a {@link Traversal} {@code []}
+ * to the callers.
*/
public class NestedTraversalSourceListVisitor extends GremlinBaseVisitor<Traversal[]> {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NoOpTerminalVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NoOpTerminalVisitor.java
index ed9062b..707e3ec 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NoOpTerminalVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/NoOpTerminalVisitor.java
@@ -19,12 +19,15 @@
package org.apache.tinkerpop.gremlin.language.grammar;
import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
/**
* {@inheritDoc}
*
- * The same as parent visitor {@link GremlinAntlrToJava} but returns bytecode instead of a Traversal or TraversalSource,
- * and uses an overridden terminal step visitor
+ * The same as parent visitor {@link GremlinAntlrToJava} but returns {@link Bytecode} instead of a {@link Traversal}
+ * or {@link GraphTraversalSource}, and uses an overridden terminal step visitor.
*/
public class NoOpTerminalVisitor extends GremlinAntlrToJava {
@@ -33,8 +36,9 @@ public class NoOpTerminalVisitor extends GremlinAntlrToJava {
}
/**
- * Returns bytecode of traversal or traversal source, overriding any terminal step operations to prevent them from
- * being executed using the {@link TraversalTerminalMethodVisitor} to append terminal operations to bytecode.
+ * Returns {@link Bytecode} of {@link Traversal} or {@link GraphTraversalSource}, overriding any terminal step
+ * operations to prevent them from being executed using the {@link TraversalTerminalMethodVisitor} to append
+ * terminal operations to bytecode.
*
* @param ctx - the parse tree
* @return - bytecode from the traversal or traversal source
@@ -69,11 +73,9 @@ public class NoOpTerminalVisitor extends GremlinAntlrToJava {
}
}
} else {
- // TODO: what queries hit this path?
- return String.valueOf(visitChildren(ctx));
+ // not clear what valid Gremlin, if any, will trigger this at the moment.
+ throw new GremlinParserException("Unexpected parse tree for NoOpTerminalVisitor");
}
}
-
-
}
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TerminalMethodToBytecodeVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TerminalMethodToBytecodeVisitor.java
index 5936601..2a32fc1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TerminalMethodToBytecodeVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TerminalMethodToBytecodeVisitor.java
@@ -21,6 +21,10 @@ package org.apache.tinkerpop.gremlin.language.grammar;
import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+/**
+ * Handles terminal steps for {@link Bytecode} as they are not added this way naturally. They are normally treated as
+ * the point of traversal execution.
+ */
public class TerminalMethodToBytecodeVisitor extends TraversalTerminalMethodVisitor {
public TerminalMethodToBytecodeVisitor(final Traversal traversal) {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalEnumParser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalEnumParser.java
index b79666a..00b31be 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalEnumParser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalEnumParser.java
@@ -19,20 +19,10 @@
package org.apache.tinkerpop.gremlin.language.grammar;
import org.antlr.v4.runtime.tree.ParseTree;
+import org.apache.tinkerpop.gremlin.process.traversal.Scope;
/**
- * Traversal enum parser parses all the enums in graph traversal.
- * These include:
- * org.apache.tinkerpop.gremlin.process.traversal.Scope
- * org.apache.tinkerpop.gremlin.process.traversal.Order
- * org.apache.tinkerpop.gremlin.process.traversal.Pop
- * org.apache.tinkerpop.gremlin.process.traversal.SackFunctions$Barrier
- * org.apache.tinkerpop.gremlin.process.traversal.Operator
- * org.apache.tinkerpop.gremlin.structure.T
- * org.apache.tinkerpop.gremlin.structure.Column
- * org.apache.tinkerpop.gremlin.structure.Direction
- * org.apache.tinkerpop.gremlin.structure.VertexProperty$Cardinality
- * org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent$Pick
+ * Traversal enum parser parses all the enums like (e.g. {@link Scope} in graph traversal.
*/
public class TraversalEnumParser {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalFunctionVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalFunctionVisitor.java
index a286da8..70274e6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalFunctionVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalFunctionVisitor.java
@@ -25,7 +25,6 @@ import java.util.function.Function;
/**
* Traversal Function parser parses Function enums.
- * As it is stateless, we use singleton to avoid object creation/deletion
*/
public class TraversalFunctionVisitor extends GremlinBaseVisitor<Function> {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalMethodVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalMethodVisitor.java
index 026ea84..9b67447 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalMethodVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalMethodVisitor.java
@@ -29,6 +29,8 @@ import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import java.util.function.BiFunction;
+
import static org.apache.tinkerpop.gremlin.process.traversal.SackFunctions.Barrier.normSack;
/**
@@ -36,10 +38,12 @@ import static org.apache.tinkerpop.gremlin.process.traversal.SackFunctions.Barri
* a GraphTraversal object.
*/
public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal> {
- // This object is used to append the traversal methods.
- private GraphTraversal graphTraversal;
+ /**
+ * This object is used to append the traversal methods.
+ */
+ private final GraphTraversal graphTraversal;
- public TraversalMethodVisitor(final GremlinAntlrToJava antlr, GraphTraversal graphTraversal) {
+ public TraversalMethodVisitor(final GremlinAntlrToJava antlr, final GraphTraversal graphTraversal) {
super(antlr, graphTraversal);
this.graphTraversal = graphTraversal;
}
@@ -58,11 +62,10 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_V(final GremlinParser.TraversalMethod_VContext ctx) {
if (ctx.genericLiteralList().getChildCount() != 0) {
- this.graphTraversal = this.graphTraversal.V(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
+ return this.graphTraversal.V(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
} else {
- this.graphTraversal = this.graphTraversal.V();
+ return this.graphTraversal.V();
}
- return this.graphTraversal;
}
/**
@@ -70,8 +73,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_addV_Empty(final GremlinParser.TraversalMethod_addV_EmptyContext ctx) {
- this.graphTraversal = this.graphTraversal.addV();
- return this.graphTraversal;
+ return this.graphTraversal.addV();
}
/**
@@ -79,20 +81,17 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_addV_String(final GremlinParser.TraversalMethod_addV_StringContext ctx) {
- this.graphTraversal = this.graphTraversal.addV(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return this.graphTraversal.addV(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
@Override
public GraphTraversal visitTraversalMethod_addE_Traversal(final GremlinParser.TraversalMethod_addE_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.addE(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.addE(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
@Override
public GraphTraversal visitTraversalMethod_addV_Traversal(final GremlinParser.TraversalMethod_addV_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.addV(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.addV(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
@Override
@@ -100,8 +99,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
final int childIndexOfParameterEdgeLabel = 2;
final GremlinParser.StringLiteralContext stringLiteralContext =
(GremlinParser.StringLiteralContext) (ctx.getChild(childIndexOfParameterEdgeLabel));
- this.graphTraversal = this.graphTraversal.addE(GenericLiteralVisitor.getStringLiteral(stringLiteralContext));
- return this.graphTraversal;
+ return this.graphTraversal.addE(GenericLiteralVisitor.getStringLiteral(stringLiteralContext));
}
/**
@@ -109,8 +107,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_aggregate_String(final GremlinParser.TraversalMethod_aggregate_StringContext ctx) {
- this.graphTraversal = graphTraversal.aggregate(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.aggregate(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -118,10 +115,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_aggregate_Scope_String(final GremlinParser.TraversalMethod_aggregate_Scope_StringContext ctx) {
- this.graphTraversal = graphTraversal.aggregate(
+ return graphTraversal.aggregate(
TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
}
/**
@@ -129,9 +125,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_and(final GremlinParser.TraversalMethod_andContext ctx) {
- this.graphTraversal = this.graphTraversal.and(
- antlr.anonymousListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
- return this.graphTraversal;
+ return this.graphTraversal.and(
+ antlr.tListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
}
/**
@@ -140,12 +135,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_as(final GremlinParser.TraversalMethod_asContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.as(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return graphTraversal.as(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else {
- this.graphTraversal = graphTraversal.as(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.as(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -155,8 +149,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
public GraphTraversal visitTraversalMethod_barrier_Consumer(final GremlinParser.TraversalMethod_barrier_ConsumerContext ctx) {
// normSack is a special consumer enum type defined in org.apache.tinkerpop.gremlin.process.traversal.SackFunctions.Barrier
// it is not used in any other traversal methods.
- this.graphTraversal = this.graphTraversal.barrier(normSack);
- return this.graphTraversal;
+ return this.graphTraversal.barrier(normSack);
}
/**
@@ -164,8 +157,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_barrier_Empty(final GremlinParser.TraversalMethod_barrier_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.barrier();
- return this.graphTraversal;
+ return graphTraversal.barrier();
}
/**
@@ -173,8 +165,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_barrier_int(final GremlinParser.TraversalMethod_barrier_intContext ctx) {
- this.graphTraversal = graphTraversal.barrier(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.barrier(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -182,8 +173,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_both(final GremlinParser.TraversalMethod_bothContext ctx) {
- graphTraversal.both(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.both(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -191,8 +181,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_bothE(final GremlinParser.TraversalMethod_bothEContext ctx) {
- this.graphTraversal = graphTraversal.bothE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.bothE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -200,8 +189,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_bothV(final GremlinParser.TraversalMethod_bothVContext ctx) {
- this.graphTraversal = graphTraversal.bothV();
- return this.graphTraversal;
+ return graphTraversal.bothV();
}
/**
@@ -209,8 +197,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_branch(final GremlinParser.TraversalMethod_branchContext ctx) {
- this.graphTraversal = this.graphTraversal.branch(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.branch(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -218,8 +205,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Comparator(final GremlinParser.TraversalMethod_by_ComparatorContext ctx) {
- this.graphTraversal = graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(2)));
}
/**
@@ -227,8 +213,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Empty(final GremlinParser.TraversalMethod_by_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.by();
- return this.graphTraversal;
+ return graphTraversal.by();
}
/**
@@ -236,8 +221,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Function(final GremlinParser.TraversalMethod_by_FunctionContext ctx) {
- this.graphTraversal = graphTraversal.by(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()));
- return this.graphTraversal;
+ return graphTraversal.by(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()));
}
/**
@@ -245,9 +229,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Function_Comparator(final GremlinParser.TraversalMethod_by_Function_ComparatorContext ctx) {
- this.graphTraversal = graphTraversal.by(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()),
+ return graphTraversal.by(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()),
TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(4)));
- return this.graphTraversal;
}
/**
@@ -255,8 +238,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Order(final GremlinParser.TraversalMethod_by_OrderContext ctx) {
- this.graphTraversal = graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(2)));
}
/**
@@ -264,8 +246,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_String(final GremlinParser.TraversalMethod_by_StringContext ctx) {
- this.graphTraversal = graphTraversal.by(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.by(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -273,9 +254,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_String_Comparator(final GremlinParser.TraversalMethod_by_String_ComparatorContext ctx) {
- this.graphTraversal = graphTraversal.by(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.by(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(4)));
- return this.graphTraversal;
}
/**
@@ -283,8 +263,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_T(final GremlinParser.TraversalMethod_by_TContext ctx) {
- this.graphTraversal = graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.by(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)));
}
/**
@@ -292,9 +271,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Traversal(final GremlinParser.TraversalMethod_by_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.by(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.by(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -302,10 +279,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_by_Traversal_Comparator(final GremlinParser.TraversalMethod_by_Traversal_ComparatorContext ctx) {
- this.graphTraversal =
- this.graphTraversal.by(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()),
+ return this.graphTraversal.by(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()),
TraversalEnumParser.parseTraversalEnumFromContext(Order.class, ctx.getChild(4)));
- return this.graphTraversal;
}
/**
@@ -314,12 +289,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_cap(final GremlinParser.TraversalMethod_capContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.cap(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return graphTraversal.cap(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else {
- this.graphTraversal = graphTraversal.cap(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.cap(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -327,8 +301,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Function(final GremlinParser.TraversalMethod_choose_FunctionContext ctx) {
- graphTraversal.choose(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()));
- return this.graphTraversal;
+ return graphTraversal.choose(TraversalFunctionVisitor.getInstance().visitTraversalFunction(ctx.traversalFunction()));
}
/**
@@ -336,9 +309,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Predicate_Traversal(final GremlinParser.TraversalMethod_choose_Predicate_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.choose(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()),
+ return graphTraversal.choose(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
/**
@@ -346,10 +318,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Predicate_Traversal_Traversal(final GremlinParser.TraversalMethod_choose_Predicate_Traversal_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.choose(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()),
+ return graphTraversal.choose(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(0)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(1)));
- return this.graphTraversal;
}
/**
@@ -357,8 +328,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Traversal(final GremlinParser.TraversalMethod_choose_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -366,9 +336,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Traversal_Traversal(final GremlinParser.TraversalMethod_choose_Traversal_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(0)),
+ return this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(0)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(1)));
- return this.graphTraversal;
}
/**
@@ -376,10 +345,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_choose_Traversal_Traversal_Traversal(final GremlinParser.TraversalMethod_choose_Traversal_Traversal_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(0)),
+ return this.graphTraversal.choose(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(0)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(1)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal(2)));
- return this.graphTraversal;
}
/**
@@ -387,9 +355,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_coalesce(final GremlinParser.TraversalMethod_coalesceContext ctx) {
- this.graphTraversal = this.graphTraversal.coalesce(
- antlr.anonymousListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
- return this.graphTraversal;
+ return this.graphTraversal.coalesce(
+ antlr.tListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
}
/**
@@ -397,8 +364,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_coin(final GremlinParser.TraversalMethod_coinContext ctx) {
- this.graphTraversal = graphTraversal.coin(Double.valueOf(ctx.floatLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.coin(Double.valueOf(ctx.floatLiteral().getText()));
}
/**
@@ -406,9 +372,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_constant(final GremlinParser.TraversalMethod_constantContext ctx) {
- this.graphTraversal = graphTraversal
+ return graphTraversal
.constant(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
}
/**
@@ -416,8 +381,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_count_Empty(final GremlinParser.TraversalMethod_count_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.count();
- return this.graphTraversal;
+ return graphTraversal.count();
}
/**
@@ -425,8 +389,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_count_Scope(final GremlinParser.TraversalMethod_count_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.count(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.count(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -434,8 +397,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_cyclicPath(final GremlinParser.TraversalMethod_cyclicPathContext ctx) {
- this.graphTraversal = graphTraversal.cyclicPath();
- return this.graphTraversal;
+ return graphTraversal.cyclicPath();
}
/**
@@ -443,9 +405,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_dedup_Scope_String(final GremlinParser.TraversalMethod_dedup_Scope_StringContext ctx) {
- this.graphTraversal = graphTraversal.dedup(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.dedup(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
}
/**
@@ -453,8 +414,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_dedup_String(final GremlinParser.TraversalMethod_dedup_StringContext ctx) {
- this.graphTraversal = graphTraversal.dedup(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.dedup(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -462,8 +422,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_drop(final GremlinParser.TraversalMethod_dropContext ctx) {
- this.graphTraversal = graphTraversal.drop();
- return this.graphTraversal;
+ return graphTraversal.drop();
}
/**
@@ -471,8 +430,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_emit_Empty(final GremlinParser.TraversalMethod_emit_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.emit();
- return this.graphTraversal;
+ return graphTraversal.emit();
}
/**
@@ -480,8 +438,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_emit_Predicate(final GremlinParser.TraversalMethod_emit_PredicateContext ctx) {
- this.graphTraversal = graphTraversal.emit(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.emit(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -489,9 +446,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_emit_Traversal(final GremlinParser.TraversalMethod_emit_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.emit(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.emit(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -499,8 +454,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_filter_Predicate(final GremlinParser.TraversalMethod_filter_PredicateContext ctx) {
- this.graphTraversal = graphTraversal.filter(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.filter(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -508,9 +462,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_filter_Traversal(final GremlinParser.TraversalMethod_filter_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.filter(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.filter(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -518,9 +470,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_flatMap(final GremlinParser.TraversalMethod_flatMapContext ctx) {
- this.graphTraversal =
- this.graphTraversal.flatMap(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.flatMap(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -528,8 +478,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_fold_Empty(final GremlinParser.TraversalMethod_fold_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.fold();
- return this.graphTraversal;
+ return graphTraversal.fold();
}
/**
@@ -537,9 +486,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_fold_Object_BiFunction(final GremlinParser.TraversalMethod_fold_Object_BiFunctionContext ctx) {
- graphTraversal.fold(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
- TraversalEnumParser.parseTraversalEnumFromContext(Operator.class, ctx.getChild(4)));
- return this.graphTraversal;
+ return graphTraversal.fold(
+ GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
+ (BiFunction) TraversalEnumParser.parseTraversalEnumFromContext(Operator.class, ctx.getChild(4)));
}
/**
@@ -547,8 +496,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_from_String(final GremlinParser.TraversalMethod_from_StringContext ctx) {
- this.graphTraversal = graphTraversal.from(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.from(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -556,9 +504,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_from_Traversal(final GremlinParser.TraversalMethod_from_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.from(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.from(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -566,8 +512,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_groupCount_Empty(final GremlinParser.TraversalMethod_groupCount_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.groupCount();
- return this.graphTraversal;
+ return graphTraversal.groupCount();
}
/**
@@ -575,8 +520,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_groupCount_String(final GremlinParser.TraversalMethod_groupCount_StringContext ctx) {
- this.graphTraversal = graphTraversal.groupCount(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.groupCount(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -584,8 +528,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_group_Empty(final GremlinParser.TraversalMethod_group_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.group();
- return this.graphTraversal;
+ return graphTraversal.group();
}
/**
@@ -593,8 +536,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_group_String(final GremlinParser.TraversalMethod_group_StringContext ctx) {
- this.graphTraversal = graphTraversal.group(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.group(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -602,9 +544,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasId_Object_Object(final GremlinParser.TraversalMethod_hasId_Object_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.hasId(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
+ return graphTraversal.hasId(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
}
/**
@@ -612,8 +553,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasId_P(final GremlinParser.TraversalMethod_hasId_PContext ctx) {
- this.graphTraversal = graphTraversal.hasId(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.hasId(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -621,8 +561,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasKey_P(final GremlinParser.TraversalMethod_hasKey_PContext ctx) {
- this.graphTraversal = graphTraversal.hasKey(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.hasKey(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -631,12 +570,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_hasKey_String_String(final GremlinParser.TraversalMethod_hasKey_String_StringContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.hasKey(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return graphTraversal.hasKey(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else {
- this.graphTraversal = graphTraversal.hasKey(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.hasKey(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -644,8 +582,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasLabel_P(final GremlinParser.TraversalMethod_hasLabel_PContext ctx) {
- this.graphTraversal = graphTraversal.hasLabel(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.hasLabel(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -654,12 +591,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_hasLabel_String_String(final GremlinParser.TraversalMethod_hasLabel_String_StringContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.hasLabel(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return graphTraversal.hasLabel(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else {
- this.graphTraversal = graphTraversal.hasLabel(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.hasLabel(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -667,8 +603,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasNot(final GremlinParser.TraversalMethod_hasNotContext ctx) {
- this.graphTraversal = graphTraversal.hasNot(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.hasNot(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -676,9 +611,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasValue_Object_Object(final GremlinParser.TraversalMethod_hasValue_Object_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.hasValue(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
+ return graphTraversal.hasValue(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
}
/**
@@ -686,8 +620,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_hasValue_P(final GremlinParser.TraversalMethod_hasValue_PContext ctx) {
- this.graphTraversal = graphTraversal.hasValue(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.hasValue(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -695,8 +628,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String(final GremlinParser.TraversalMethod_has_StringContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -704,9 +636,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String_Object(final GremlinParser.TraversalMethod_has_String_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
new GenericLiteralVisitor(antlr).visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
}
/**
@@ -714,9 +645,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String_P(final GremlinParser.TraversalMethod_has_String_PContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
}
/**
@@ -724,10 +654,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String_String_Object(final GremlinParser.TraversalMethod_has_String_String_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(1)),
GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
}
/**
@@ -735,10 +664,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String_String_P(final GremlinParser.TraversalMethod_has_String_String_PContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(1)),
TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
}
/**
@@ -746,9 +674,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_String_Traversal(final GremlinParser.TraversalMethod_has_String_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.has(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
/**
@@ -756,9 +683,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_T_Object(final GremlinParser.TraversalMethod_has_T_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
+ return graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
new GenericLiteralVisitor(antlr).visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
}
/**
@@ -766,9 +692,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_T_P(final GremlinParser.TraversalMethod_has_T_PContext ctx) {
- this.graphTraversal = graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
+ return graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
}
/**
@@ -776,9 +701,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_has_T_Traversal(final GremlinParser.TraversalMethod_has_T_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
+ return graphTraversal.has(TraversalEnumParser.parseTraversalEnumFromContext(T.class, ctx.getChild(2)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
/**
@@ -786,8 +710,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_id(final GremlinParser.TraversalMethod_idContext ctx) {
- this.graphTraversal = graphTraversal.id();
- return this.graphTraversal;
+ return graphTraversal.id();
}
/**
@@ -795,8 +718,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_identity(final GremlinParser.TraversalMethod_identityContext ctx) {
- this.graphTraversal = graphTraversal.identity();
- return this.graphTraversal;
+ return graphTraversal.identity();
}
/**
@@ -804,8 +726,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_in(final GremlinParser.TraversalMethod_inContext ctx) {
- this.graphTraversal = graphTraversal.in(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.in(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -813,8 +734,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_inE(final GremlinParser.TraversalMethod_inEContext ctx) {
- this.graphTraversal = graphTraversal.inE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.inE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -822,8 +742,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_inV(final GremlinParser.TraversalMethod_inVContext ctx) {
- this.graphTraversal = graphTraversal.inV();
- return this.graphTraversal;
+ return graphTraversal.inV();
}
/**
@@ -831,14 +750,12 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_inject(final GremlinParser.TraversalMethod_injectContext ctx) {
- this.graphTraversal = graphTraversal.inject(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.inject(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
}
@Override
public GraphTraversal visitTraversalMethod_index(final GremlinParser.TraversalMethod_indexContext ctx) {
- this.graphTraversal = graphTraversal.index();
- return this.graphTraversal;
+ return graphTraversal.index();
}
/**
@@ -846,8 +763,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_is_Object(final GremlinParser.TraversalMethod_is_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.is(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
+ return graphTraversal.is(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()));
}
/**
@@ -855,8 +771,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_is_P(final GremlinParser.TraversalMethod_is_PContext ctx) {
- this.graphTraversal = graphTraversal.is(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.is(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -864,8 +779,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_key(final GremlinParser.TraversalMethod_keyContext ctx) {
- this.graphTraversal = graphTraversal.key();
- return this.graphTraversal;
+ return graphTraversal.key();
}
/**
@@ -873,8 +787,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_label(final GremlinParser.TraversalMethod_labelContext ctx) {
- this.graphTraversal = graphTraversal.label();
- return this.graphTraversal;
+ return graphTraversal.label();
}
/**
@@ -882,9 +795,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_limit_Scope_long(final GremlinParser.TraversalMethod_limit_Scope_longContext ctx) {
- this.graphTraversal = graphTraversal.limit(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.limit(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
}
/**
@@ -892,8 +804,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_limit_long(final GremlinParser.TraversalMethod_limit_longContext ctx) {
- this.graphTraversal = graphTraversal.limit(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.limit(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -901,64 +812,54 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_local(final GremlinParser.TraversalMethod_localContext ctx) {
- this.graphTraversal = graphTraversal.local(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return graphTraversal.local(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
@Override
public GraphTraversal visitTraversalMethod_loops_Empty(final GremlinParser.TraversalMethod_loops_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.loops();
- return this.graphTraversal;
+ return graphTraversal.loops();
}
@Override
public GraphTraversal visitTraversalMethod_loops_String(final GremlinParser.TraversalMethod_loops_StringContext ctx) {
- this.graphTraversal = graphTraversal.loops(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.loops(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
@Override
public GraphTraversal visitTraversalMethod_repeat_String_Traversal(final GremlinParser.TraversalMethod_repeat_String_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.repeat((GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral())),
+ return graphTraversal.repeat((GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral())),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
@Override
public GraphTraversal visitTraversalMethod_repeat_Traversal(final GremlinParser.TraversalMethod_repeat_TraversalContext ctx) {
- this.graphTraversal = this.graphTraversal.repeat(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.repeat(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
@Override
public GraphTraversal visitTraversalMethod_read(final GremlinParser.TraversalMethod_readContext ctx) {
- this.graphTraversal = graphTraversal.read();
- return this.graphTraversal;
+ return graphTraversal.read();
}
@Override
public GraphTraversal visitTraversalMethod_write(final GremlinParser.TraversalMethod_writeContext ctx) {
- this.graphTraversal = graphTraversal.write();
- return this.graphTraversal;
+ return graphTraversal.write();
}
@Override
public GraphTraversal visitTraversalMethod_with_String(final GremlinParser.TraversalMethod_with_StringContext ctx) {
- this.graphTraversal = graphTraversal.with(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.with(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
@Override
public GraphTraversal visitTraversalMethod_with_String_Object(final GremlinParser.TraversalMethod_with_String_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.with(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.with(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
new GenericLiteralVisitor(antlr).visitGenericLiteral(ctx.genericLiteral()));
- return this.graphTraversal;
}
@Override
public GraphTraversal visitTraversalMethod_shortestPath(final GremlinParser.TraversalMethod_shortestPathContext ctx) {
- this.graphTraversal = graphTraversal.shortestPath();
- return this.graphTraversal;
+ return graphTraversal.shortestPath();
}
/**
@@ -966,8 +867,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_map(final GremlinParser.TraversalMethod_mapContext ctx) {
- this.graphTraversal = this.graphTraversal.map(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.map(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -975,9 +875,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_match(final GremlinParser.TraversalMethod_matchContext ctx) {
- this.graphTraversal = this.graphTraversal.match(
- antlr.anonymousListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
- return this.graphTraversal;
+ return this.graphTraversal.match(
+ antlr.tListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
}
/**
@@ -985,8 +884,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_max_Empty(final GremlinParser.TraversalMethod_max_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.max();
- return this.graphTraversal;
+ return graphTraversal.max();
}
/**
@@ -994,8 +892,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_max_Scope(final GremlinParser.TraversalMethod_max_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.max(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.max(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1003,8 +900,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_mean_Empty(final GremlinParser.TraversalMethod_mean_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.mean();
- return this.graphTraversal;
+ return graphTraversal.mean();
}
/**
@@ -1012,8 +908,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_mean_Scope(final GremlinParser.TraversalMethod_mean_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.mean(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.mean(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1021,8 +916,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_min_Empty(final GremlinParser.TraversalMethod_min_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.min();
- return this.graphTraversal;
+ return graphTraversal.min();
}
/**
@@ -1030,8 +924,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_min_Scope(final GremlinParser.TraversalMethod_min_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.min(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.min(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1039,8 +932,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_not(final GremlinParser.TraversalMethod_notContext ctx) {
- this.graphTraversal = this.graphTraversal.not(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.not(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1048,9 +940,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_option_Object_Traversal(final GremlinParser.TraversalMethod_option_Object_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.option(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
+ return graphTraversal.option(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral()),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
/**
@@ -1058,9 +949,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_option_Traversal(final GremlinParser.TraversalMethod_option_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.option(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.option(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1068,9 +957,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_optional(final GremlinParser.TraversalMethod_optionalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.optional(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.optional(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1078,9 +965,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_or(final GremlinParser.TraversalMethod_orContext ctx) {
- this.graphTraversal = this.graphTraversal.or(
- antlr.anonymousListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
- return this.graphTraversal;
+ return this.graphTraversal.or(
+ antlr.tListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
}
/**
@@ -1088,8 +974,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_order_Empty(final GremlinParser.TraversalMethod_order_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.order();
- return this.graphTraversal;
+ return graphTraversal.order();
}
/**
@@ -1097,8 +982,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_order_Scope(final GremlinParser.TraversalMethod_order_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.order(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.order(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1106,8 +990,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_otherV(final GremlinParser.TraversalMethod_otherVContext ctx) {
- this.graphTraversal = graphTraversal.otherV();
- return this.graphTraversal;
+ return graphTraversal.otherV();
}
/**
@@ -1115,8 +998,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_out(final GremlinParser.TraversalMethod_outContext ctx) {
- this.graphTraversal = graphTraversal.out(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.out(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1124,8 +1006,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_outE(final GremlinParser.TraversalMethod_outEContext ctx) {
- this.graphTraversal = graphTraversal.outE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.outE(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1133,8 +1014,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_outV(final GremlinParser.TraversalMethod_outVContext ctx) {
- this.graphTraversal = graphTraversal.outV();
- return this.graphTraversal;
+ return graphTraversal.outV();
}
/**
@@ -1142,8 +1022,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_pageRank_Empty(final GremlinParser.TraversalMethod_pageRank_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.pageRank();
- return this.graphTraversal;
+ return graphTraversal.pageRank();
}
/**
@@ -1151,8 +1030,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_pageRank_double(final GremlinParser.TraversalMethod_pageRank_doubleContext ctx) {
- this.graphTraversal = graphTraversal.pageRank(Double.valueOf(ctx.floatLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.pageRank(Double.valueOf(ctx.floatLiteral().getText()));
}
/**
@@ -1160,8 +1038,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_path(final GremlinParser.TraversalMethod_pathContext ctx) {
- this.graphTraversal = graphTraversal.path();
- return this.graphTraversal;
+ return graphTraversal.path();
}
/**
@@ -1169,8 +1046,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_peerPressure(final GremlinParser.TraversalMethod_peerPressureContext ctx) {
- this.graphTraversal = graphTraversal.peerPressure();
- return this.graphTraversal;
+ return graphTraversal.peerPressure();
}
/**
@@ -1178,8 +1054,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_profile_Empty(final GremlinParser.TraversalMethod_profile_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.profile();
- return this.graphTraversal;
+ return graphTraversal.profile();
}
/**
@@ -1187,8 +1062,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_profile_String(final GremlinParser.TraversalMethod_profile_StringContext ctx) {
- this.graphTraversal = graphTraversal.profile(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.profile(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1197,12 +1071,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_project(final GremlinParser.TraversalMethod_projectContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.project(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return graphTraversal.project(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else {
- this.graphTraversal = graphTraversal.project(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.project(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -1210,8 +1083,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_properties(final GremlinParser.TraversalMethod_propertiesContext ctx) {
- this.graphTraversal = graphTraversal.properties(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.properties(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1219,8 +1091,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_elementMap(final GremlinParser.TraversalMethod_elementMapContext ctx) {
- this.graphTraversal = graphTraversal.elementMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.elementMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1228,8 +1099,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_propertyMap(final GremlinParser.TraversalMethod_propertyMapContext ctx) {
- this.graphTraversal = graphTraversal.propertyMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.propertyMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1237,11 +1107,10 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_property_Cardinality_Object_Object_Object(final GremlinParser.TraversalMethod_property_Cardinality_Object_Object_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.property(TraversalEnumParser.parseTraversalEnumFromContext(VertexProperty.Cardinality.class, ctx.getChild(2)),
+ return graphTraversal.property(TraversalEnumParser.parseTraversalEnumFromContext(VertexProperty.Cardinality.class, ctx.getChild(2)),
GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral(0)),
GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral(1)),
GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
}
/**
@@ -1249,10 +1118,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_property_Object_Object_Object(final GremlinParser.TraversalMethod_property_Object_Object_ObjectContext ctx) {
- this.graphTraversal = graphTraversal.property(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral(0)),
+ return graphTraversal.property(GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral(0)),
GenericLiteralVisitor.getInstance().visitGenericLiteral(ctx.genericLiteral(1)),
GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
}
/**
@@ -1260,10 +1128,9 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_range_Scope_long_long(final GremlinParser.TraversalMethod_range_Scope_long_longContext ctx) {
- this.graphTraversal = graphTraversal.range(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.range(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
Integer.valueOf(ctx.integerLiteral(0).getText()),
Integer.valueOf(ctx.integerLiteral(1).getText()));
- return this.graphTraversal;
}
/**
@@ -1271,9 +1138,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_range_long_long(final GremlinParser.TraversalMethod_range_long_longContext ctx) {
- this.graphTraversal = graphTraversal.range(Integer.valueOf(ctx.integerLiteral(0).getText()),
+ return graphTraversal.range(Integer.valueOf(ctx.integerLiteral(0).getText()),
Integer.valueOf(ctx.integerLiteral(1).getText()));
- return this.graphTraversal;
}
/**
@@ -1281,8 +1147,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sack_BiFunction(final GremlinParser.TraversalMethod_sack_BiFunctionContext ctx) {
- graphTraversal.sack(TraversalEnumParser.parseTraversalEnumFromContext(Operator.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.sack(TraversalEnumParser.parseTraversalEnumFromContext(Operator.class, ctx.getChild(2)));
}
/**
@@ -1290,8 +1155,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sack_Empty(final GremlinParser.TraversalMethod_sack_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.sack();
- return this.graphTraversal;
+ return graphTraversal.sack();
}
/**
@@ -1299,9 +1163,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sample_Scope_int(final GremlinParser.TraversalMethod_sample_Scope_intContext ctx) {
- this.graphTraversal = graphTraversal.sample(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.sample(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
}
/**
@@ -1309,8 +1172,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sample_int(final GremlinParser.TraversalMethod_sample_intContext ctx) {
- this.graphTraversal = graphTraversal.sample(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.sample(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -1318,8 +1180,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_select_Column(final GremlinParser.TraversalMethod_select_ColumnContext ctx) {
- this.graphTraversal = graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Column.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Column.class, ctx.getChild(2)));
}
/**
@@ -1327,9 +1188,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_select_Pop_String(final GremlinParser.TraversalMethod_select_Pop_StringContext ctx) {
- this.graphTraversal = graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
+ return graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
}
/**
@@ -1337,18 +1197,16 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_select_Pop_String_String_String(final GremlinParser.TraversalMethod_select_Pop_String_String_StringContext ctx) {
- this.graphTraversal = graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
+ return graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(1)),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
}
@Override
public GraphTraversal visitTraversalMethod_select_Pop_Traversal(final GremlinParser.TraversalMethod_select_Pop_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
+ return graphTraversal.select(TraversalEnumParser.parseTraversalEnumFromContext(Pop.class, ctx.getChild(2)),
antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
}
/**
@@ -1356,8 +1214,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_select_String(final GremlinParser.TraversalMethod_select_StringContext ctx) {
- this.graphTraversal = graphTraversal.select(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.select(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1365,16 +1222,14 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_select_String_String_String(final GremlinParser.TraversalMethod_select_String_String_StringContext ctx) {
- this.graphTraversal = graphTraversal.select(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
+ return graphTraversal.select(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(0)),
GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral(1)),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
}
@Override
public GraphTraversal visitTraversalMethod_select_Traversal(final GremlinParser.TraversalMethod_select_TraversalContext ctx) {
- this.graphTraversal = graphTraversal.select(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return graphTraversal.select(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1382,9 +1237,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sideEffect(final GremlinParser.TraversalMethod_sideEffectContext ctx) {
- this.graphTraversal =
- this.graphTraversal.sideEffect(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.sideEffect(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1392,8 +1245,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_simplePath(final GremlinParser.TraversalMethod_simplePathContext ctx) {
- this.graphTraversal = graphTraversal.simplePath();
- return this.graphTraversal;
+ return graphTraversal.simplePath();
}
/**
@@ -1401,9 +1253,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_skip_Scope_long(final GremlinParser.TraversalMethod_skip_Scope_longContext ctx) {
- this.graphTraversal = graphTraversal.skip(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.skip(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
}
/**
@@ -1411,8 +1262,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_skip_long(final GremlinParser.TraversalMethod_skip_longContext ctx) {
- this.graphTraversal = graphTraversal.skip(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.skip(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -1420,8 +1270,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_store(final GremlinParser.TraversalMethod_storeContext ctx) {
- this.graphTraversal = graphTraversal.store(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.store(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1429,8 +1278,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_subgraph(final GremlinParser.TraversalMethod_subgraphContext ctx) {
- this.graphTraversal = graphTraversal.subgraph(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.subgraph(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1438,8 +1286,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sum_Empty(final GremlinParser.TraversalMethod_sum_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.sum();
- return this.graphTraversal;
+ return graphTraversal.sum();
}
/**
@@ -1447,8 +1294,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_sum_Scope(final GremlinParser.TraversalMethod_sum_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.sum(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.sum(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1456,8 +1302,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tail_Empty(final GremlinParser.TraversalMethod_tail_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.tail();
- return this.graphTraversal;
+ return graphTraversal.tail();
}
/**
@@ -1465,8 +1310,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tail_Scope(final GremlinParser.TraversalMethod_tail_ScopeContext ctx) {
- this.graphTraversal = graphTraversal.tail(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.tail(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)));
}
/**
@@ -1474,9 +1318,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tail_Scope_long(final GremlinParser.TraversalMethod_tail_Scope_longContext ctx) {
- this.graphTraversal = graphTraversal.tail(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
+ return graphTraversal.tail(TraversalEnumParser.parseTraversalEnumFromContext(Scope.class, ctx.getChild(2)),
Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
}
/**
@@ -1484,8 +1327,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tail_long(final GremlinParser.TraversalMethod_tail_longContext ctx) {
- this.graphTraversal = graphTraversal.tail(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.tail(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -1493,8 +1335,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_timeLimit(final GremlinParser.TraversalMethod_timeLimitContext ctx) {
- this.graphTraversal = graphTraversal.timeLimit(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.timeLimit(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -1502,8 +1343,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_times(final GremlinParser.TraversalMethod_timesContext ctx) {
- this.graphTraversal = graphTraversal.times(Integer.valueOf(ctx.integerLiteral().getText()));
- return this.graphTraversal;
+ return graphTraversal.times(Integer.valueOf(ctx.integerLiteral().getText()));
}
/**
@@ -1511,9 +1351,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_toE(final GremlinParser.TraversalMethod_toEContext ctx) {
- this.graphTraversal = graphTraversal.toE(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)),
+ return graphTraversal.toE(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
}
/**
@@ -1521,8 +1360,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_toV(final GremlinParser.TraversalMethod_toVContext ctx) {
- this.graphTraversal = graphTraversal.toV(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)));
- return this.graphTraversal;
+ return graphTraversal.toV(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)));
}
/**
@@ -1530,9 +1368,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_to_Direction_String(final GremlinParser.TraversalMethod_to_Direction_StringContext ctx) {
- this.graphTraversal = graphTraversal.to(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)),
+ return graphTraversal.to(TraversalEnumParser.parseTraversalEnumFromContext(Direction.class, ctx.getChild(2)),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
}
/**
@@ -1540,8 +1377,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_to_String(final GremlinParser.TraversalMethod_to_StringContext ctx) {
- this.graphTraversal = graphTraversal.to(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.to(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1549,9 +1385,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_to_Traversal(final GremlinParser.TraversalMethod_to_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.to(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.to(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1559,8 +1393,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tree_Empty(final GremlinParser.TraversalMethod_tree_EmptyContext ctx) {
- this.graphTraversal = graphTraversal.tree();
- return this.graphTraversal;
+ return graphTraversal.tree();
}
/**
@@ -1568,8 +1401,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_tree_String(final GremlinParser.TraversalMethod_tree_StringContext ctx) {
- this.graphTraversal = graphTraversal.tree(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.tree(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
/**
@@ -1577,8 +1409,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_unfold(final GremlinParser.TraversalMethod_unfoldContext ctx) {
- this.graphTraversal = graphTraversal.unfold();
- return this.graphTraversal;
+ return graphTraversal.unfold();
}
/**
@@ -1586,9 +1417,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_union(final GremlinParser.TraversalMethod_unionContext ctx) {
- this.graphTraversal = this.graphTraversal.union(
- antlr.anonymousListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
- return this.graphTraversal;
+ return this.graphTraversal.union(
+ antlr.tListVisitor.visitNestedTraversalList(ctx.nestedTraversalList()));
}
/**
@@ -1596,8 +1426,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_until_Predicate(final GremlinParser.TraversalMethod_until_PredicateContext ctx) {
- this.graphTraversal = graphTraversal.until(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.until(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -1605,9 +1434,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_until_Traversal(final GremlinParser.TraversalMethod_until_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.until(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.until(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
/**
@@ -1615,8 +1442,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_value(final GremlinParser.TraversalMethod_valueContext ctx) {
- this.graphTraversal = graphTraversal.value();
- return this.graphTraversal;
+ return graphTraversal.value();
}
/**
@@ -1624,8 +1450,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_valueMap_String(final GremlinParser.TraversalMethod_valueMap_StringContext ctx) {
- this.graphTraversal = graphTraversal.valueMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.valueMap(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1634,12 +1459,11 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
@Override
public GraphTraversal visitTraversalMethod_valueMap_boolean_String(final GremlinParser.TraversalMethod_valueMap_boolean_StringContext ctx) {
if (ctx.getChildCount() == 4) {
- this.graphTraversal = graphTraversal.valueMap(Boolean.valueOf(ctx.booleanLiteral().getText()));
+ return graphTraversal.valueMap(Boolean.valueOf(ctx.booleanLiteral().getText()));
} else {
- this.graphTraversal = graphTraversal.valueMap(Boolean.valueOf(ctx.booleanLiteral().getText()),
+ return graphTraversal.valueMap(Boolean.valueOf(ctx.booleanLiteral().getText()),
GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
- return this.graphTraversal;
}
/**
@@ -1647,8 +1471,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_values(final GremlinParser.TraversalMethod_valuesContext ctx) {
- this.graphTraversal = graphTraversal.values(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
- return this.graphTraversal;
+ return graphTraversal.values(GenericLiteralVisitor.getStringLiteralList(ctx.stringLiteralList()));
}
/**
@@ -1656,8 +1479,7 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_where_P(final GremlinParser.TraversalMethod_where_PContext ctx) {
- this.graphTraversal = graphTraversal.where(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
+ return graphTraversal.where(TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
}
/**
@@ -1665,9 +1487,8 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_where_String_P(final GremlinParser.TraversalMethod_where_String_PContext ctx) {
- this.graphTraversal = graphTraversal.where(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
+ return graphTraversal.where(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()),
TraversalPredicateVisitor.getInstance().visitTraversalPredicate(ctx.traversalPredicate()));
- return this.graphTraversal;
}
/**
@@ -1675,15 +1496,12 @@ public class TraversalMethodVisitor extends TraversalRootVisitor<GraphTraversal>
*/
@Override
public GraphTraversal visitTraversalMethod_where_Traversal(final GremlinParser.TraversalMethod_where_TraversalContext ctx) {
- this.graphTraversal =
- this.graphTraversal.where(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
- return this.graphTraversal;
+ return this.graphTraversal.where(antlr.tvisitor.visitNestedTraversal(ctx.nestedTraversal()));
}
@Override
public GraphTraversal visitTraversalMethod_math(final GremlinParser.TraversalMethod_mathContext ctx) {
- this.graphTraversal = graphTraversal.math(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
- return this.graphTraversal;
+ return graphTraversal.math(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
}
public GraphTraversal[] getNestedTraversalList(final GremlinParser.NestedTraversalListContext ctx) {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalPredicateVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalPredicateVisitor.java
index 6be27b2..1e1b470 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalPredicateVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalPredicateVisitor.java
@@ -26,9 +26,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
-/**
- * As this class does not need any status, use singleton pattern to avoid object creation and GC overhead.
- */
public class TraversalPredicateVisitor extends GremlinBaseVisitor<P> {
private static TraversalPredicateVisitor instance;
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalRootVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalRootVisitor.java
index 239c87e..25c40d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalRootVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalRootVisitor.java
@@ -58,7 +58,8 @@ public class TraversalRootVisitor<G extends Traversal> extends GremlinBaseVisito
if (ctx.getChild(0) instanceof GremlinParser.RootTraversalContext) {
return visitChildren(ctx);
} else if (ctx.getChild(2) instanceof GremlinParser.ChainedParentOfGraphTraversalContext) {
- return new TraversalRootVisitor<Traversal>(antlr.createAnonymous.get()).visitChainedParentOfGraphTraversal(ctx.chainedTraversal().chainedParentOfGraphTraversal());
+ return new TraversalRootVisitor<Traversal>(antlr.createAnonymous.get()).
+ visitChainedParentOfGraphTraversal(ctx.chainedTraversal().chainedParentOfGraphTraversal());
} else {
return new TraversalMethodVisitor(antlr, antlr.createAnonymous.get()).visitChainedTraversal(ctx.chainedTraversal());
}
@@ -84,10 +85,12 @@ public class TraversalRootVisitor<G extends Traversal> extends GremlinBaseVisito
if (ctx.getChild(childIndexOfChainedTraversal) instanceof GremlinParser.ChainedParentOfGraphTraversalContext) {
final TraversalRootVisitor traversalRootVisitor = new TraversalRootVisitor(traversal);
- return traversalRootVisitor.visitChainedParentOfGraphTraversal((GremlinParser.ChainedParentOfGraphTraversalContext) ctx.getChild(childIndexOfChainedTraversal));
+ return traversalRootVisitor.visitChainedParentOfGraphTraversal(
+ (GremlinParser.ChainedParentOfGraphTraversalContext) ctx.getChild(childIndexOfChainedTraversal));
} else {
final TraversalMethodVisitor traversalMethodVisitor = new TraversalMethodVisitor(antlr, traversal);
- return traversalMethodVisitor.visitChainedTraversal((GremlinParser.ChainedTraversalContext) ctx.getChild(childIndexOfChainedTraversal));
+ return traversalMethodVisitor.visitChainedTraversal(
+ (GremlinParser.ChainedTraversalContext) ctx.getChild(childIndexOfChainedTraversal));
}
} else {
return traversal;
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSelfMethodVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSelfMethodVisitor.java
index 916999e..8833950 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSelfMethodVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSelfMethodVisitor.java
@@ -27,7 +27,7 @@ import java.util.Arrays;
import java.util.List;
/**
- * Graph Traversal source self method visitor
+ * A {@link GraphTraversalSource} self method visitor.
*/
public class TraversalSourceSelfMethodVisitor extends GremlinBaseVisitor<GraphTraversalSource> {
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSpawnMethodVisitor.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSpawnMethodVisitor.java
index 2f8dbf9..d4ca8d9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSpawnMethodVisitor.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/TraversalSourceSpawnMethodVisitor.java
@@ -23,8 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
/**
- * This class implements gremlin grammar's source-spawn methods which uses a
- * GraphTraversalSource as the source and returns a GraphTraversal object.
+ * Use a {@link GraphTraversalSource} as the source and returns a {@link GraphTraversal} object.
*/
public class TraversalSourceSpawnMethodVisitor extends GremlinBaseVisitor<GraphTraversal> {
@@ -52,14 +51,12 @@ public class TraversalSourceSpawnMethodVisitor extends GremlinBaseVisitor<GraphT
@Override
public GraphTraversal visitTraversalSourceSpawnMethod_addE(final GremlinParser.TraversalSourceSpawnMethod_addEContext ctx) {
if (ctx.stringLiteral() != null) {
- this.graphTraversal = this.traversalSource.addE(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return this.traversalSource.addE(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else if (ctx.nestedTraversal() != null) {
- this.graphTraversal = this.traversalSource.addE(anonymousVisitor.visitNestedTraversal(ctx.nestedTraversal()));
+ return this.traversalSource.addE(anonymousVisitor.visitNestedTraversal(ctx.nestedTraversal()));
} else {
throw new IllegalArgumentException("addE with empty arguments is not valid.");
}
-
- return this.graphTraversal;
}
/**
@@ -68,13 +65,12 @@ public class TraversalSourceSpawnMethodVisitor extends GremlinBaseVisitor<GraphT
@Override
public GraphTraversal visitTraversalSourceSpawnMethod_addV(final GremlinParser.TraversalSourceSpawnMethod_addVContext ctx) {
if (ctx.stringLiteral() != null) {
- this.graphTraversal = this.traversalSource.addV(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
+ return this.traversalSource.addV(GenericLiteralVisitor.getStringLiteral(ctx.stringLiteral()));
} else if (ctx.nestedTraversal() != null) {
- this.graphTraversal = this.traversalSource.addV(anonymousVisitor.visitNestedTraversal(ctx.nestedTraversal()));
+ return this.traversalSource.addV(anonymousVisitor.visitNestedTraversal(ctx.nestedTraversal()));
} else {
- this.graphTraversal = this.traversalSource.addV();
+ return this.traversalSource.addV();
}
- return this.graphTraversal;
}
/**
@@ -83,11 +79,10 @@ public class TraversalSourceSpawnMethodVisitor extends GremlinBaseVisitor<GraphT
@Override
public GraphTraversal visitTraversalSourceSpawnMethod_E(final GremlinParser.TraversalSourceSpawnMethod_EContext ctx) {
if (ctx.genericLiteralList().getChildCount() > 0) {
- this.graphTraversal = this.traversalSource.E(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
+ return this.traversalSource.E(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
} else {
- this.graphTraversal = this.traversalSource.E();
+ return this.traversalSource.E();
}
- return this.graphTraversal;
}
/**
@@ -96,19 +91,17 @@ public class TraversalSourceSpawnMethodVisitor extends GremlinBaseVisitor<GraphT
@Override
public GraphTraversal visitTraversalSourceSpawnMethod_V(final GremlinParser.TraversalSourceSpawnMethod_VContext ctx) {
if (ctx.genericLiteralList().getChildCount() > 0) {
- this.graphTraversal = this.traversalSource.V(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
+ return this.traversalSource.V(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
} else {
- this.graphTraversal = this.traversalSource.V();
+ return this.traversalSource.V();
}
- return this.graphTraversal;
}
/**
* {@inheritDoc}
*/
@Override
public GraphTraversal visitTraversalSourceSpawnMethod_inject(final GremlinParser.TraversalSourceSpawnMethod_injectContext ctx) {
- this.graphTraversal = this.traversalSource.inject(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
- return this.graphTraversal;
+ return this.traversalSource.inject(GenericLiteralVisitor.getGenericLiteralList(ctx.genericLiteralList()));
}
/**
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json b/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
index 92215b8..41c6b17 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/package-lock.json
@@ -616,7 +616,7 @@
"es5-ext": {
"version": "0.10.53",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz",
- "integrity": "sha1-k8WjrP2+8nUiCtcmRK0C7hg2jeE=",
+ "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==",
"dev": true,
"requires": {
"es6-iterator": "~2.0.3",
@@ -638,7 +638,7 @@
"es6-symbol": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
- "integrity": "sha1-utXTwbzawoJp9MszHkMceKxwXRg=",
+ "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
"dev": true,
"requires": {
"d": "^1.0.1",
@@ -716,7 +716,7 @@
"ext": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz",
- "integrity": "sha1-ia56BxWPedNVF4gpBDJAd+Q3kkQ=",
+ "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==",
"dev": true,
"requires": {
"type": "^2.0.0"
@@ -966,7 +966,7 @@
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
- "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=",
+ "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -1052,7 +1052,7 @@
"nopt": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
- "integrity": "sha1-o3XK2dAv2SEnjZVMIlTVqlfhXkg=",
+ "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
"dev": true,
"requires": {
"abbrev": "1",
@@ -1666,7 +1666,7 @@
"mocha": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz",
- "integrity": "sha1-bYrlCPWRZ/lA8rWzxKYSrlDJCuY=",
+ "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==",
"dev": true,
"requires": {
"browser-stdout": "1.3.1",
@@ -1685,13 +1685,13 @@
"commander": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
- "integrity": "sha1-30boZ9D8Kuxmo0ZitAapzK//Ww8=",
+ "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
- "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
@@ -1700,7 +1700,7 @@
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
- "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=",
+ "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
@@ -1723,7 +1723,7 @@
"supports-color": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz",
- "integrity": "sha1-HGszdALCE3YF7+GfEP7DkPb6q1Q=",
+ "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
@@ -2374,7 +2374,7 @@
"thenify": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
- "integrity": "sha1-iTLmhqQGYDigFt2eLKRq3Zg4qV8=",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
"dev": true,
"requires": {
"any-promise": "^1.0.0"