Add special handling for __.Fold() This solves the problem with the generic type parameters of the created GraphTraversal for the Fold step. It needs to be <object, E2> instead of <object, IList<E2>> as the called Fold step in GraphTraversal already returns <S, IList<E>>.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/73e2537a Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/73e2537a Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/73e2537a Branch: refs/heads/TINKERPOP-1752 Commit: 73e2537a1474c46f7ce1fab2a3d025704a12ba30 Parents: 239a3c6 Author: florianhockmann <[email protected]> Authored: Sun Sep 3 13:34:23 2017 +0200 Committer: florianhockmann <[email protected]> Committed: Sun Sep 3 13:34:23 2017 +0200 ---------------------------------------------------------------------- gremlin-dotnet/glv/AnonymousTraversal.template | 2 +- gremlin-dotnet/pom.xml | 14 +- .../Process/Traversal/GraphTraversal.cs | 332 +++++++++---------- .../Process/Traversal/GraphTraversalSource.cs | 52 +-- .../src/Gremlin.Net/Process/Traversal/__.cs | 262 +++++++-------- 5 files changed, 336 insertions(+), 326 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73e2537a/gremlin-dotnet/glv/AnonymousTraversal.template ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/glv/AnonymousTraversal.template b/gremlin-dotnet/glv/AnonymousTraversal.template index d4f99d5..a740ef6 100644 --- a/gremlin-dotnet/glv/AnonymousTraversal.template +++ b/gremlin-dotnet/glv/AnonymousTraversal.template @@ -45,7 +45,7 @@ namespace Gremlin.Net.Process.Traversal /// </summary> public static GraphTraversal<object, <%= method.t2 %>> <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %>(<%= method.parameters %>) { - return new GraphTraversal<object, <%= method.t2 %>>().<%= toCSharpMethodName.call(method.methodName) %><%= method.callGenericTypeArg %>(<%= method.paramNames %>); + return new GraphTraversal<object, <%= method.graphTraversalT2 %>>().<%= toCSharpMethodName.call(method.methodName) %><%= method.callGenericTypeArg %>(<%= method.paramNames %>); } <% } %> } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73e2537a/gremlin-dotnet/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/pom.xml b/gremlin-dotnet/pom.xml index 9609d0d..6cf271e 100644 --- a/gremlin-dotnet/pom.xml +++ b/gremlin-dotnet/pom.xml @@ -223,7 +223,16 @@ def hasMethodNoGenericCounterPartInGraphTraversal = { method -> } } return false -} +} + +def t2withSpecialGraphTraversalt2 = ["IList<E2>": "E2"] + +def getGraphTraversalT2ForT2 = { t2 -> + if (t2withSpecialGraphTraversalt2.containsKey(t2)) { + return t2withSpecialGraphTraversalt2.get(t2) + } + return t2 +} def binding = ["pmethods": P.class.getMethods(). findAll { Modifier.isStatic(it.getModifiers()) }. @@ -284,7 +293,8 @@ def binding = ["pmethods": P.class.getMethods(). def parameters = getCSharpParamString(javaMethod) def paramNames = getParamNames(javaMethod.parameters).join(", ") def callGenericTypeArg = hasMethodNoGenericCounterPartInGraphTraversal(javaMethod) ? "" : tParam - return ["methodName": javaMethod.name, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames, "callGenericTypeArg":callGenericTypeArg] + def graphTraversalT2 = getGraphTraversalT2ForT2(t2) + return ["methodName": javaMethod.name, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames, "callGenericTypeArg":callGenericTypeArg, "graphTraversalT2":graphTraversalT2] }, "toCSharpMethodName": toCSharpMethodName] http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73e2537a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs index b9db513..9e9ed30 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs @@ -115,9 +115,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , Vertex > AddV () + public GraphTraversal< S , Vertex > AddV (string vertexLabel) { - var args = new List<object> { }; + var args = new List<object> { vertexLabel }; Bytecode.AddStep("addV", args); return Wrap< S , Vertex >(this); } @@ -125,9 +125,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , Vertex > AddV (params object[] propertyKeyValues) + public GraphTraversal< S , Vertex > AddV () { - var args = new List<object> { propertyKeyValues }; + var args = new List<object> { }; Bytecode.AddStep("addV", args); return Wrap< S , Vertex >(this); } @@ -135,9 +135,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , Vertex > AddV (string vertexLabel) + public GraphTraversal< S , Vertex > AddV (params object[] propertyKeyValues) { - var args = new List<object> { vertexLabel }; + var args = new List<object> { propertyKeyValues }; Bytecode.AddStep("addV", args); return Wrap< S , Vertex >(this); } @@ -185,9 +185,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the barrier step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Barrier (int maxBarrierSize) + public GraphTraversal< S , E > Barrier () { - var args = new List<object> { maxBarrierSize }; + var args = new List<object> { }; Bytecode.AddStep("barrier", args); return Wrap< S , E >(this); } @@ -195,9 +195,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the barrier step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Barrier () + public GraphTraversal< S , E > Barrier (int maxBarrierSize) { - var args = new List<object> { }; + var args = new List<object> { maxBarrierSize }; Bytecode.AddStep("barrier", args); return Wrap< S , E >(this); } @@ -255,9 +255,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (T token) + public GraphTraversal< S , E > By (Order order) { - var args = new List<object> { token }; + var args = new List<object> { order }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -265,9 +265,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (string key) + public GraphTraversal< S , E > By (string key, object comparator) { - var args = new List<object> { key }; + var args = new List<object> { key, comparator }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -275,9 +275,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (object function) + public GraphTraversal< S , E > By (string key) { - var args = new List<object> { function }; + var args = new List<object> { key }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -285,9 +285,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By () + public GraphTraversal< S , E > By (object function) { - var args = new List<object> { }; + var args = new List<object> { function }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -295,9 +295,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (ITraversal traversal) + public GraphTraversal< S , E > By (object comparator) { - var args = new List<object> { traversal }; + var args = new List<object> { comparator }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -305,9 +305,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (object function, object comparator) + public GraphTraversal< S , E > By (ITraversal traversal) { - var args = new List<object> { function, comparator }; + var args = new List<object> { traversal }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -315,9 +315,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (string key, object comparator) + public GraphTraversal< S , E > By () { - var args = new List<object> { key, comparator }; + var args = new List<object> { }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -325,9 +325,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (Order order) + public GraphTraversal< S , E > By (object function, object comparator) { - var args = new List<object> { order }; + var args = new List<object> { function, comparator }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -335,9 +335,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (object comparator) + public GraphTraversal< S , E > By (ITraversal traversal, object comparator) { - var args = new List<object> { comparator }; + var args = new List<object> { traversal, comparator }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -345,9 +345,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the by step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > By (ITraversal traversal, object comparator) + public GraphTraversal< S , E > By (T token) { - var args = new List<object> { traversal, comparator }; + var args = new List<object> { token }; Bytecode.AddStep("by", args); return Wrap< S , E >(this); } @@ -365,9 +365,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Choose<E2> (ITraversal choiceTraversal) + public GraphTraversal< S , E2 > Choose<E2> (ITraversal traversalPredicate, ITraversal trueChoice) { - var args = new List<object> { choiceTraversal }; + var args = new List<object> { traversalPredicate, trueChoice }; Bytecode.AddStep("choose", args); return Wrap< S , E2 >(this); } @@ -375,9 +375,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Choose<E2> (ITraversal traversalPredicate, ITraversal trueChoice) + public GraphTraversal< S , E2 > Choose<E2> (ITraversal traversalPredicate, ITraversal trueChoice, ITraversal falseChoice) { - var args = new List<object> { traversalPredicate, trueChoice }; + var args = new List<object> { traversalPredicate, trueChoice, falseChoice }; Bytecode.AddStep("choose", args); return Wrap< S , E2 >(this); } @@ -385,9 +385,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Choose<E2> (ITraversal traversalPredicate, ITraversal trueChoice, ITraversal falseChoice) + public GraphTraversal< S , E2 > Choose<E2> (ITraversal choiceTraversal) { - var args = new List<object> { traversalPredicate, trueChoice, falseChoice }; + var args = new List<object> { choiceTraversal }; Bytecode.AddStep("choose", args); return Wrap< S , E2 >(this); } @@ -395,9 +395,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Choose<E2> (TraversalPredicate choosePredicate, ITraversal trueChoice) + public GraphTraversal< S , E2 > Choose<E2> (object choiceFunction) { - var args = new List<object> { choosePredicate, trueChoice }; + var args = new List<object> { choiceFunction }; Bytecode.AddStep("choose", args); return Wrap< S , E2 >(this); } @@ -415,9 +415,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the choose step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Choose<E2> (object choiceFunction) + public GraphTraversal< S , E2 > Choose<E2> (TraversalPredicate choosePredicate, ITraversal trueChoice) { - var args = new List<object> { choiceFunction }; + var args = new List<object> { choosePredicate, trueChoice }; Bytecode.AddStep("choose", args); return Wrap< S , E2 >(this); } @@ -525,9 +525,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the emit step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Emit () + public GraphTraversal< S , E > Emit (TraversalPredicate emitPredicate) { - var args = new List<object> { }; + var args = new List<object> { emitPredicate }; Bytecode.AddStep("emit", args); return Wrap< S , E >(this); } @@ -535,9 +535,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the emit step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Emit (TraversalPredicate emitPredicate) + public GraphTraversal< S , E > Emit () { - var args = new List<object> { emitPredicate }; + var args = new List<object> { }; Bytecode.AddStep("emit", args); return Wrap< S , E >(this); } @@ -605,9 +605,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the from step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > From (string fromStepLabel) + public GraphTraversal< S , E > From (ITraversal fromVertex) { - var args = new List<object> { fromStepLabel }; + var args = new List<object> { fromVertex }; Bytecode.AddStep("from", args); return Wrap< S , E >(this); } @@ -615,9 +615,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the from step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > From (ITraversal fromVertex) + public GraphTraversal< S , E > From (string fromStepLabel) { - var args = new List<object> { fromVertex }; + var args = new List<object> { fromStepLabel }; Bytecode.AddStep("from", args); return Wrap< S , E >(this); } @@ -645,21 +645,21 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the groupCount step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > GroupCount (string sideEffectKey) + public GraphTraversal< S , IDictionary<K, long> > GroupCount<K> () { - var args = new List<object> { sideEffectKey }; + var args = new List<object> { }; Bytecode.AddStep("groupCount", args); - return Wrap< S , E >(this); + return Wrap< S , IDictionary<K, long> >(this); } /// <summary> /// Adds the groupCount step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , IDictionary<K, long> > GroupCount<K> () + public GraphTraversal< S , E > GroupCount (string sideEffectKey) { - var args = new List<object> { }; + var args = new List<object> { sideEffectKey }; Bytecode.AddStep("groupCount", args); - return Wrap< S , IDictionary<K, long> >(this); + return Wrap< S , E >(this); } /// <summary> @@ -685,9 +685,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (string label, string propertyKey, TraversalPredicate predicate) + public GraphTraversal< S , E > Has (string propertyKey, TraversalPredicate predicate) { - var args = new List<object> { label, propertyKey, predicate }; + var args = new List<object> { propertyKey, predicate }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -695,9 +695,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (string label, string propertyKey, object value) + public GraphTraversal< S , E > Has (string propertyKey, ITraversal propertyTraversal) { - var args = new List<object> { label, propertyKey, value }; + var args = new List<object> { propertyKey, propertyTraversal }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -705,9 +705,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (string propertyKey, ITraversal propertyTraversal) + public GraphTraversal< S , E > Has (string label, string propertyKey, object value) { - var args = new List<object> { propertyKey, propertyTraversal }; + var args = new List<object> { label, propertyKey, value }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -725,9 +725,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (T accessor, ITraversal propertyTraversal) + public GraphTraversal< S , E > Has (T accessor, TraversalPredicate predicate) { - var args = new List<object> { accessor, propertyTraversal }; + var args = new List<object> { accessor, predicate }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -735,9 +735,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (string propertyKey, TraversalPredicate predicate) + public GraphTraversal< S , E > Has (T accessor, ITraversal propertyTraversal) { - var args = new List<object> { propertyKey, predicate }; + var args = new List<object> { accessor, propertyTraversal }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -745,9 +745,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (T accessor, TraversalPredicate predicate) + public GraphTraversal< S , E > Has (string propertyKey, object value) { - var args = new List<object> { accessor, predicate }; + var args = new List<object> { propertyKey, value }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -755,9 +755,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (string propertyKey, object value) + public GraphTraversal< S , E > Has (T accessor, object value) { - var args = new List<object> { propertyKey, value }; + var args = new List<object> { accessor, value }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -765,9 +765,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Has (T accessor, object value) + public GraphTraversal< S , E > Has (string label, string propertyKey, TraversalPredicate predicate) { - var args = new List<object> { accessor, value }; + var args = new List<object> { label, propertyKey, predicate }; Bytecode.AddStep("has", args); return Wrap< S , E >(this); } @@ -775,9 +775,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the hasId step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > HasId (object id, params object[] otherIds) + public GraphTraversal< S , E > HasId (TraversalPredicate predicate) { - var args = new List<object> { id, otherIds }; + var args = new List<object> { predicate }; Bytecode.AddStep("hasId", args); return Wrap< S , E >(this); } @@ -785,9 +785,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the hasId step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > HasId (TraversalPredicate predicate) + public GraphTraversal< S , E > HasId (object id, params object[] otherIds) { - var args = new List<object> { predicate }; + var args = new List<object> { id, otherIds }; Bytecode.AddStep("hasId", args); return Wrap< S , E >(this); } @@ -965,21 +965,21 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the limit step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Limit<E2> (Scope scope, long limit) + public GraphTraversal< S , E > Limit (long limit) { - var args = new List<object> { scope, limit }; + var args = new List<object> { limit }; Bytecode.AddStep("limit", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> /// Adds the limit step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Limit (long limit) + public GraphTraversal< S , E2 > Limit<E2> (Scope scope, long limit) { - var args = new List<object> { limit }; + var args = new List<object> { scope, limit }; Bytecode.AddStep("limit", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> @@ -1055,9 +1055,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the max step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Max<E2> () + public GraphTraversal< S , E2 > Max<E2> (Scope scope) { - var args = new List<object> { }; + var args = new List<object> { scope }; Bytecode.AddStep("max", args); return Wrap< S , E2 >(this); } @@ -1065,9 +1065,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the max step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Max<E2> (Scope scope) + public GraphTraversal< S , E2 > Max<E2> () { - var args = new List<object> { scope }; + var args = new List<object> { }; Bytecode.AddStep("max", args); return Wrap< S , E2 >(this); } @@ -1095,9 +1095,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the min step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Min<E2> (Scope scope) + public GraphTraversal< S , E2 > Min<E2> () { - var args = new List<object> { scope }; + var args = new List<object> { }; Bytecode.AddStep("min", args); return Wrap< S , E2 >(this); } @@ -1105,9 +1105,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the min step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Min<E2> () + public GraphTraversal< S , E2 > Min<E2> (Scope scope) { - var args = new List<object> { }; + var args = new List<object> { scope }; Bytecode.AddStep("min", args); return Wrap< S , E2 >(this); } @@ -1165,9 +1165,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the order step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Order (Scope scope) + public GraphTraversal< S , E > Order () { - var args = new List<object> { scope }; + var args = new List<object> { }; Bytecode.AddStep("order", args); return Wrap< S , E >(this); } @@ -1175,9 +1175,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the order step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Order () + public GraphTraversal< S , E > Order (Scope scope) { - var args = new List<object> { }; + var args = new List<object> { scope }; Bytecode.AddStep("order", args); return Wrap< S , E >(this); } @@ -1265,21 +1265,21 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the profile step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Profile (string sideEffectKey) + public GraphTraversal< S , E2 > Profile<E2> () { - var args = new List<object> { sideEffectKey }; + var args = new List<object> { }; Bytecode.AddStep("profile", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the profile step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Profile<E2> () + public GraphTraversal< S , E > Profile (string sideEffectKey) { - var args = new List<object> { }; + var args = new List<object> { sideEffectKey }; Bytecode.AddStep("profile", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> @@ -1315,9 +1315,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the property step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Property (Cardinality cardinality, object key, object value, params object[] keyValues) + public GraphTraversal< S , E > Property (object key, object value, params object[] keyValues) { - var args = new List<object> { cardinality, key, value, keyValues }; + var args = new List<object> { key, value, keyValues }; Bytecode.AddStep("property", args); return Wrap< S , E >(this); } @@ -1325,9 +1325,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the property step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Property (object key, object value, params object[] keyValues) + public GraphTraversal< S , E > Property (Cardinality cardinality, object key, object value, params object[] keyValues) { - var args = new List<object> { key, value, keyValues }; + var args = new List<object> { cardinality, key, value, keyValues }; Bytecode.AddStep("property", args); return Wrap< S , E >(this); } @@ -1345,21 +1345,21 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the range step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Range (long low, long high) + public GraphTraversal< S , E2 > Range<E2> (Scope scope, long low, long high) { - var args = new List<object> { low, high }; + var args = new List<object> { scope, low, high }; Bytecode.AddStep("range", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the range step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Range<E2> (Scope scope, long low, long high) + public GraphTraversal< S , E > Range (long low, long high) { - var args = new List<object> { scope, low, high }; + var args = new List<object> { low, high }; Bytecode.AddStep("range", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> @@ -1375,19 +1375,19 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sack step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Sack (object sackOperator) + public GraphTraversal< S , E2 > Sack<E2> () { - var args = new List<object> { sackOperator }; + var args = new List<object> { }; Bytecode.AddStep("sack", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the sack step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Sack (object sackOperator, string elementPropertyKey) + public GraphTraversal< S , E > Sack (object sackOperator) { - var args = new List<object> { sackOperator, elementPropertyKey }; + var args = new List<object> { sackOperator }; Bytecode.AddStep("sack", args); return Wrap< S , E >(this); } @@ -1395,19 +1395,19 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sack step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Sack<E2> () + public GraphTraversal< S , E > Sack (object sackOperator, string elementPropertyKey) { - var args = new List<object> { }; + var args = new List<object> { sackOperator, elementPropertyKey }; Bytecode.AddStep("sack", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> /// Adds the sample step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Sample (Scope scope, int amountToSample) + public GraphTraversal< S , E > Sample (int amountToSample) { - var args = new List<object> { scope, amountToSample }; + var args = new List<object> { amountToSample }; Bytecode.AddStep("sample", args); return Wrap< S , E >(this); } @@ -1415,9 +1415,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sample step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Sample (int amountToSample) + public GraphTraversal< S , E > Sample (Scope scope, int amountToSample) { - var args = new List<object> { amountToSample }; + var args = new List<object> { scope, amountToSample }; Bytecode.AddStep("sample", args); return Wrap< S , E >(this); } @@ -1425,9 +1425,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the select step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , IDictionary<string, E2> > Select<E2> (Pop pop, string selectKey1, string selectKey2, params string[] otherSelectKeys) + public GraphTraversal< S , IDictionary<string, E2> > Select<E2> (string selectKey1, string selectKey2, params string[] otherSelectKeys) { - var args = new List<object> { pop, selectKey1, selectKey2, otherSelectKeys }; + var args = new List<object> { selectKey1, selectKey2, otherSelectKeys }; Bytecode.AddStep("select", args); return Wrap< S , IDictionary<string, E2> >(this); } @@ -1435,49 +1435,49 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the select step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Select<E2> (Pop pop, string selectKey) + public GraphTraversal< S , IDictionary<string, E2> > Select<E2> (Pop pop, string selectKey1, string selectKey2, params string[] otherSelectKeys) { - var args = new List<object> { pop, selectKey }; + var args = new List<object> { pop, selectKey1, selectKey2, otherSelectKeys }; Bytecode.AddStep("select", args); - return Wrap< S , E2 >(this); + return Wrap< S , IDictionary<string, E2> >(this); } /// <summary> /// Adds the select step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Select<E2> (string selectKey) + public GraphTraversal< S , ICollection<E2> > Select<E2> (Column column) { - var args = new List<object> { selectKey }; + var args = new List<object> { column }; Bytecode.AddStep("select", args); - return Wrap< S , E2 >(this); + return Wrap< S , ICollection<E2> >(this); } /// <summary> /// Adds the select step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , ICollection<E2> > Select<E2> (Column column) + public GraphTraversal< S , E2 > Select<E2> (string selectKey) { - var args = new List<object> { column }; + var args = new List<object> { selectKey }; Bytecode.AddStep("select", args); - return Wrap< S , ICollection<E2> >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the select step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , IDictionary<string, E2> > Select<E2> (string selectKey1, string selectKey2, params string[] otherSelectKeys) + public GraphTraversal< S , E2 > Select<E2> (Pop pop, string selectKey) { - var args = new List<object> { selectKey1, selectKey2, otherSelectKeys }; + var args = new List<object> { pop, selectKey }; Bytecode.AddStep("select", args); - return Wrap< S , IDictionary<string, E2> >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the sideEffect step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > SideEffect (object consumer) + public GraphTraversal< S , E > SideEffect (ITraversal sideEffectTraversal) { - var args = new List<object> { consumer }; + var args = new List<object> { sideEffectTraversal }; Bytecode.AddStep("sideEffect", args); return Wrap< S , E >(this); } @@ -1485,9 +1485,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sideEffect step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > SideEffect (ITraversal sideEffectTraversal) + public GraphTraversal< S , E > SideEffect (object consumer) { - var args = new List<object> { sideEffectTraversal }; + var args = new List<object> { consumer }; Bytecode.AddStep("sideEffect", args); return Wrap< S , E >(this); } @@ -1525,9 +1525,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sum step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Sum<E2> (Scope scope) + public GraphTraversal< S , E2 > Sum<E2> () { - var args = new List<object> { scope }; + var args = new List<object> { }; Bytecode.AddStep("sum", args); return Wrap< S , E2 >(this); } @@ -1535,9 +1535,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the sum step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Sum<E2> () + public GraphTraversal< S , E2 > Sum<E2> (Scope scope) { - var args = new List<object> { }; + var args = new List<object> { scope }; Bytecode.AddStep("sum", args); return Wrap< S , E2 >(this); } @@ -1545,11 +1545,11 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Tail () + public GraphTraversal< S , E2 > Tail<E2> (Scope scope, long limit) { - var args = new List<object> { }; + var args = new List<object> { scope, limit }; Bytecode.AddStep("tail", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> @@ -1575,11 +1575,11 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Tail<E2> (Scope scope, long limit) + public GraphTraversal< S , E > Tail () { - var args = new List<object> { scope, limit }; + var args = new List<object> { }; Bytecode.AddStep("tail", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> @@ -1615,9 +1615,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the to step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > To (string toStepLabel) + public GraphTraversal< S , E > To (ITraversal toVertex) { - var args = new List<object> { toStepLabel }; + var args = new List<object> { toVertex }; Bytecode.AddStep("to", args); return Wrap< S , E >(this); } @@ -1625,9 +1625,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the to step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > To (ITraversal toVertex) + public GraphTraversal< S , E > To (string toStepLabel) { - var args = new List<object> { toVertex }; + var args = new List<object> { toStepLabel }; Bytecode.AddStep("to", args); return Wrap< S , E >(this); } @@ -1655,21 +1655,21 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the tree step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Tree (string sideEffectKey) + public GraphTraversal< S , E2 > Tree<E2> () { - var args = new List<object> { sideEffectKey }; + var args = new List<object> { }; Bytecode.AddStep("tree", args); - return Wrap< S , E >(this); + return Wrap< S , E2 >(this); } /// <summary> /// Adds the tree step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E2 > Tree<E2> () + public GraphTraversal< S , E > Tree (string sideEffectKey) { - var args = new List<object> { }; + var args = new List<object> { sideEffectKey }; Bytecode.AddStep("tree", args); - return Wrap< S , E2 >(this); + return Wrap< S , E >(this); } /// <summary> @@ -1725,9 +1725,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (bool includeTokens, params string[] propertyKeys) + public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (params string[] propertyKeys) { - var args = new List<object> { includeTokens, propertyKeys }; + var args = new List<object> { propertyKeys }; Bytecode.AddStep("valueMap", args); return Wrap< S , IDictionary<string, E2> >(this); } @@ -1735,9 +1735,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (params string[] propertyKeys) + public GraphTraversal< S , IDictionary<string, E2> > ValueMap<E2> (bool includeTokens, params string[] propertyKeys) { - var args = new List<object> { propertyKeys }; + var args = new List<object> { includeTokens, propertyKeys }; Bytecode.AddStep("valueMap", args); return Wrap< S , IDictionary<string, E2> >(this); } @@ -1765,9 +1765,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the where step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Where (ITraversal whereTraversal) + public GraphTraversal< S , E > Where (string startKey, TraversalPredicate predicate) { - var args = new List<object> { whereTraversal }; + var args = new List<object> { startKey, predicate }; Bytecode.AddStep("where", args); return Wrap< S , E >(this); } @@ -1775,9 +1775,9 @@ namespace Gremlin.Net.Process.Traversal /// <summary> /// Adds the where step to this <see cref="GraphTraversal{SType, EType}" />. /// </summary> - public GraphTraversal< S , E > Where (string startKey, TraversalPredicate predicate) + public GraphTraversal< S , E > Where (ITraversal whereTraversal) { - var args = new List<object> { startKey, predicate }; + var args = new List<object> { whereTraversal }; Bytecode.AddStep("where", args); return Wrap< S , E >(this); } http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/73e2537a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs ---------------------------------------------------------------------- diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs index 7dc602d..5770c47 100644 --- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs +++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs @@ -99,38 +99,38 @@ namespace Gremlin.Net.Process.Traversal return source; } - public GraphTraversalSource WithSack(object initialValue, object splitOperator) + public GraphTraversalSource WithSack(object initialValue, object splitOperator, object mergeOperator) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue, splitOperator }; + var args = new List<object> { initialValue, splitOperator, mergeOperator }; source.Bytecode.AddSource("withSack", args); return source; } - public GraphTraversalSource WithSack(object initialValue, object splitOperator) + public GraphTraversalSource WithSack(object initialValue) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue, splitOperator }; + var args = new List<object> { initialValue }; source.Bytecode.AddSource("withSack", args); return source; } - public GraphTraversalSource WithSack(object initialValue, object splitOperator, object mergeOperator) + public GraphTraversalSource WithSack(object initialValue) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue, splitOperator, mergeOperator }; + var args = new List<object> { initialValue }; source.Bytecode.AddSource("withSack", args); return source; } - public GraphTraversalSource WithSack(object initialValue) + public GraphTraversalSource WithSack(object initialValue, object splitOperator) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue }; + var args = new List<object> { initialValue, splitOperator }; source.Bytecode.AddSource("withSack", args); return source; } @@ -144,56 +144,56 @@ namespace Gremlin.Net.Process.Traversal return source; } - public GraphTraversalSource WithSack(object initialValue) + public GraphTraversalSource WithSack(object initialValue, object mergeOperator) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue }; + var args = new List<object> { initialValue, mergeOperator }; source.Bytecode.AddSource("withSack", args); return source; } - public GraphTraversalSource WithSack(object initialValue, object mergeOperator) + public GraphTraversalSource WithSack(object initialValue, object splitOperator) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { initialValue, mergeOperator }; + var args = new List<object> { initialValue, splitOperator }; source.Bytecode.AddSource("withSack", args); return source; } - public GraphTraversalSource WithSideEffect(string key, object initialValue, object reducer) + public GraphTraversalSource WithSideEffect(string key, object initialValue) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { key, initialValue, reducer }; + var args = new List<object> { key, initialValue }; source.Bytecode.AddSource("withSideEffect", args); return source; } - public GraphTraversalSource WithSideEffect(string key, object initialValue, object reducer) + public GraphTraversalSource WithSideEffect(string key, object initialValue) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { key, initialValue, reducer }; + var args = new List<object> { key, initialValue }; source.Bytecode.AddSource("withSideEffect", args); return source; } - public GraphTraversalSource WithSideEffect(string key, object initialValue) + public GraphTraversalSource WithSideEffect(string key, object initialValue, object reducer) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { key, initialValue }; + var args = new List<object> { key, initialValue, reducer }; source.Bytecode.AddSource("withSideEffect", args); return source; } - public GraphTraversalSource WithSideEffect(string key, object initialValue) + public GraphTraversalSource WithSideEffect(string key, object initialValue, object reducer) { var source = new GraphTraversalSource(new List<ITraversalStrategy>(TraversalStrategies), new Bytecode(Bytecode)); - var args = new List<object> { key, initialValue }; + var args = new List<object> { key, initialValue, reducer }; source.Bytecode.AddSource("withSideEffect", args); return source; } @@ -279,10 +279,10 @@ namespace Gremlin.Net.Process.Traversal /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that /// traversal. /// </summary> - public GraphTraversal< Vertex,Vertex > AddV(params object[] keyValues) + public GraphTraversal< Vertex,Vertex > AddV() { var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode)); - var args = new List<object> { keyValues }; + var args = new List<object> { }; traversal.Bytecode.AddStep("addV", args); return traversal; } @@ -291,10 +291,10 @@ namespace Gremlin.Net.Process.Traversal /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that /// traversal. /// </summary> - public GraphTraversal< Vertex,Vertex > AddV(string label) + public GraphTraversal< Vertex,Vertex > AddV(params object[] keyValues) { var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode)); - var args = new List<object> { label }; + var args = new List<object> { keyValues }; traversal.Bytecode.AddStep("addV", args); return traversal; } @@ -303,10 +303,10 @@ namespace Gremlin.Net.Process.Traversal /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that /// traversal. /// </summary> - public GraphTraversal< Vertex,Vertex > AddV() + public GraphTraversal< Vertex,Vertex > AddV(string label) { var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode)); - var args = new List<object> { }; + var args = new List<object> { label }; traversal.Bytecode.AddStep("addV", args); return traversal; }
