You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2018/01/21 12:56:29 UTC
[6/6] tinkerpop git commit: Merge branch 'tp32'
Merge branch 'tp32'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a62a0111
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a62a0111
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a62a0111
Branch: refs/heads/master
Commit: a62a0111f6e2e7cf1852c9fac13201025f125871
Parents: bd9dd29 92a09d8
Author: florianhockmann <fh...@florian-hockmann.de>
Authored: Sun Jan 21 13:55:40 2018 +0100
Committer: florianhockmann <fh...@florian-hockmann.de>
Committed: Sun Jan 21 13:55:40 2018 +0100
----------------------------------------------------------------------
gremlin-dotnet/glv/GraphTraversal.template | 6 +-
.../glv/GraphTraversalSource.template | 6 +-
gremlin-dotnet/glv/generate.groovy | 40 +-
.../Process/Traversal/GraphTraversal.cs | 678 +++++++++----------
.../Process/Traversal/GraphTraversalSource.cs | 41 +-
5 files changed, 407 insertions(+), 364 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a62a0111/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --cc gremlin-dotnet/glv/generate.groovy
index 9a731d3,12cfa88..75a06dc
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@@ -26,9 -26,9 +26,10 @@@ import org.apache.tinkerpop.gremlin.pro
import org.apache.tinkerpop.gremlin.structure.Direction
import java.lang.reflect.Modifier
import java.lang.reflect.TypeVariable
+ import java.lang.reflect.GenericArrayType
def toCSharpTypeMap = ["Long": "long",
+ "Double": "double",
"Integer": "int",
"String": "string",
"boolean": "bool",
@@@ -241,14 -284,10 +270,15 @@@ def binding = ["pmethods": P.class.getM
def t1 = toCSharpType(typeNames[0])
def t2 = toCSharpType(typeNames[1])
def tParam = getCSharpGenericTypeParam(t2)
+ def specificTypes = methodsWithSpecificTypes.get(javaMethod.name)
+ if (specificTypes) {
+ t2 = specificTypes[0]
+ tParam = specificTypes.size() > 1 ? "<" + specificTypes[1] + ">" : ""
+ }
def parameters = getCSharpParamString(javaMethod, true)
def paramNames = getParamNames(javaMethod.parameters)
- return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames]
+ def argsListType = getArgsListType(parameters)
+ return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames, "argsListType":argsListType]
},
"anonStepMethods": __.class.getMethods().
findAll { GraphTraversal.class.equals(it.returnType) }.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a62a0111/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 5120ef9,d8e26ad..0f58649
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@@ -76,19 -76,43 +76,19 @@@ namespace Gremlin.Net.Process.Traversa
/// <summary>
/// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Edge > AddE (string edgeLabel)
- public GraphTraversal<S, Edge> AddE (Direction direction, string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- var args = new List<object>(3 + propertyKeyValues.Length) {direction, firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addE", args.ToArray());
- return Wrap<S, Edge>(this);
- }
-
- /// <summary>
- /// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
+ public GraphTraversal<S, Edge> AddE (string edgeLabel)
{
Bytecode.AddStep("addE", edgeLabel);
- return Wrap< S , Edge >(this);
+ return Wrap<S, Edge>(this);
}
/// <summary>
- /// Adds the addInE step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, Edge> AddInE (string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
- {
- var args = new List<object>(2 + propertyKeyValues.Length) {firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addInE", args.ToArray());
- return Wrap<S, Edge>(this);
- }
-
- /// <summary>
- /// Adds the addOutE step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// Adds the addE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Edge > AddE (ITraversal edgeLabelTraversal)
- public GraphTraversal<S, Edge> AddOutE (string firstVertexKeyOrEdgeLabel, string edgeLabelOrSecondVertexKey, params object[] propertyKeyValues)
++ public GraphTraversal<S, Edge> AddE (ITraversal edgeLabelTraversal)
{
- var args = new List<object>(2 + propertyKeyValues.Length) {firstVertexKeyOrEdgeLabel, edgeLabelOrSecondVertexKey};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addOutE", args.ToArray());
+ Bytecode.AddStep("addE", edgeLabelTraversal);
- return Wrap< S , Edge >(this);
+ return Wrap<S, Edge>(this);
}
/// <summary>
@@@ -103,19 -127,21 +103,19 @@@
/// <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)
++ public GraphTraversal<S, Vertex> AddV (string vertexLabel)
{
- var args = new List<object>(0 + propertyKeyValues.Length) {};
- args.AddRange(propertyKeyValues);
- Bytecode.AddStep("addV", args.ToArray());
+ Bytecode.AddStep("addV", vertexLabel);
- return Wrap< S , Vertex >(this);
+ return Wrap<S, Vertex>(this);
}
/// <summary>
/// Adds the addV step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Vertex > AddV (ITraversal vertexLabelTraversal)
- public GraphTraversal<S, Vertex> AddV (string vertexLabel)
++ public GraphTraversal<S, Vertex> AddV (ITraversal vertexLabelTraversal)
{
- Bytecode.AddStep("addV", vertexLabel);
+ Bytecode.AddStep("addV", vertexLabelTraversal);
- return Wrap< S , Vertex >(this);
+ return Wrap<S, Vertex>(this);
}
/// <summary>
@@@ -558,21 -584,12 +558,21 @@@
}
/// <summary>
+ /// Adds the from step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
- public GraphTraversal< S , E > From (Vertex fromVertex)
++ public GraphTraversal<S, E> From (Vertex fromVertex)
+ {
+ Bytecode.AddStep("from", fromVertex);
- return Wrap< S , E >(this);
++ return Wrap<S, E>(this);
+ }
+
+ /// <summary>
/// Adds the group step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<K, V> > Group<K, V> ()
+ public GraphTraversal<S, IDictionary<K, V>> Group<K, V> ()
{
Bytecode.AddStep("group");
- return Wrap< S , IDictionary<K, V> >(this);
+ return Wrap<S, IDictionary<K, V>>(this);
}
/// <summary>
@@@ -603,12 -620,30 +603,12 @@@
}
/// <summary>
- /// Adds the groupV3d0 step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, IDictionary<K, V>> GroupV3d0<K, V> ()
- {
- Bytecode.AddStep("groupV3d0");
- return Wrap<S, IDictionary<K, V>>(this);
- }
-
- /// <summary>
- /// Adds the groupV3d0 step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, E> GroupV3d0 (string sideEffectKey)
- {
- Bytecode.AddStep("groupV3d0", sideEffectKey);
- return Wrap<S, E>(this);
- }
-
- /// <summary>
/// Adds the has step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Has (string propertyKey)
+ public GraphTraversal<S, E> Has (string propertyKey)
{
Bytecode.AddStep("has", propertyKey);
- return Wrap< S , E >(this);
+ return Wrap<S, E>(this);
}
/// <summary>
@@@ -880,10 -915,10 +880,10 @@@
/// <summary>
/// Adds the limit step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E2 > Limit<E2> (long limit)
- public GraphTraversal<S, E> Limit (long limit)
++ public GraphTraversal<S, E2> Limit<E2> (long limit)
{
Bytecode.AddStep("limit", limit);
- return Wrap< S , E2 >(this);
- return Wrap<S, E>(this);
++ return Wrap<S, E2>(this);
}
/// <summary>
@@@ -923,9 -958,27 +923,9 @@@
}
/// <summary>
- /// Adds the mapKeys step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, E2> MapKeys<E2> ()
- {
- Bytecode.AddStep("mapKeys");
- return Wrap<S, E2>(this);
- }
-
- /// <summary>
- /// Adds the mapValues step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, E2> MapValues<E2> ()
- {
- Bytecode.AddStep("mapValues");
- return Wrap<S, E2>(this);
- }
-
- /// <summary>
/// Adds the match step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<string, E2> > Match<E2> (params ITraversal[] matchTraversals)
+ public GraphTraversal<S, IDictionary<string, E2>> Match<E2> (params ITraversal[] matchTraversals)
{
var args = new List<object>(0 + matchTraversals.Length) {};
args.AddRange(matchTraversals);
@@@ -934,21 -987,12 +934,21 @@@
}
/// <summary>
+ /// Adds the math step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
- public GraphTraversal< S , double > Math (string expression)
++ public GraphTraversal<S, double> Math (string expression)
+ {
+ Bytecode.AddStep("math", expression);
- return Wrap< S , double >(this);
++ return Wrap<S, double>(this);
+ }
+
+ /// <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> ()
{
Bytecode.AddStep("max");
- return Wrap< S , E2 >(this);
+ return Wrap<S, E2>(this);
}
/// <summary>
@@@ -1231,10 -1275,10 +1231,10 @@@
/// <summary>
/// Adds the range step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E2 > Range<E2> (long low, long high)
- public GraphTraversal<S, E> Range (long low, long high)
++ public GraphTraversal<S, E2> Range<E2> (long low, long high)
{
Bytecode.AddStep("range", low, high);
- return Wrap< S , E2 >(this);
- return Wrap<S, E>(this);
++ return Wrap<S, E2>(this);
}
/// <summary>
@@@ -1265,12 -1309,21 +1265,12 @@@
}
/// <summary>
- /// Adds the sack step to this <see cref="GraphTraversal{SType, EType}" />.
- /// </summary>
- public GraphTraversal<S, E> Sack (object sackOperator, string elementPropertyKey)
- {
- Bytecode.AddStep("sack", sackOperator, elementPropertyKey);
- 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 (Scope scope, int amountToSample)
{
Bytecode.AddStep("sample", scope, amountToSample);
- return Wrap< S , E >(this);
+ return Wrap<S, E>(this);
}
/// <summary>
@@@ -1359,30 -1412,12 +1359,30 @@@
}
/// <summary>
+ /// Adds the skip step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
- public GraphTraversal< S , E2 > Skip<E2> (Scope scope, long skip)
++ public GraphTraversal<S, E2> Skip<E2> (Scope scope, long skip)
+ {
+ Bytecode.AddStep("skip", scope, skip);
- return Wrap< S , E2 >(this);
++ return Wrap<S, E2>(this);
+ }
+
+ /// <summary>
+ /// Adds the skip step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
- public GraphTraversal< S , E2 > Skip<E2> (long skip)
++ public GraphTraversal<S, E2> Skip<E2> (long skip)
+ {
+ Bytecode.AddStep("skip", skip);
- return Wrap< S , E2 >(this);
++ return Wrap<S, E2>(this);
+ }
+
+ /// <summary>
/// Adds the store step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E > Store (string sideEffectKey)
+ public GraphTraversal<S, E> Store (string sideEffectKey)
{
Bytecode.AddStep("store", sideEffectKey);
- return Wrap< S , E >(this);
+ return Wrap<S, E>(this);
}
/// <summary>
@@@ -1415,10 -1450,10 +1415,10 @@@
/// <summary>
/// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E2 > Tail<E2> ()
- public GraphTraversal<S, E> Tail ()
++ public GraphTraversal<S, E2> Tail<E2> ()
{
Bytecode.AddStep("tail");
- return Wrap< S , E2 >(this);
- return Wrap<S, E>(this);
++ return Wrap<S, E2>(this);
}
/// <summary>
@@@ -1442,10 -1477,10 +1442,10 @@@
/// <summary>
/// Adds the tail step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , E2 > Tail<E2> (long limit)
- public GraphTraversal<S, E> Tail (long limit)
++ public GraphTraversal<S, E2> Tail<E2> (long limit)
{
Bytecode.AddStep("tail", limit);
- return Wrap< S , E2 >(this);
- return Wrap<S, E>(this);
++ return Wrap<S, E2>(this);
}
/// <summary>
@@@ -1496,18 -1531,9 +1496,18 @@@
}
/// <summary>
+ /// Adds the to step to this <see cref="GraphTraversal{SType, EType}" />.
+ /// </summary>
- public GraphTraversal< S , E > To (Vertex toVertex)
++ public GraphTraversal<S, E> To (Vertex toVertex)
+ {
+ Bytecode.AddStep("to", toVertex);
- return Wrap< S , E >(this);
++ return Wrap<S, E>(this);
+ }
+
+ /// <summary>
/// Adds the toE step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , Edge > ToE (Direction direction, params string[] edgeLabels)
+ public GraphTraversal<S, Edge> ToE (Direction direction, params string[] edgeLabels)
{
var args = new List<object>(1 + edgeLabels.Length) {direction};
args.AddRange(edgeLabels);
@@@ -1592,23 -1618,23 +1592,23 @@@
/// <summary>
/// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<TKey, TValue> > ValueMap<TKey, TValue> (params string[] propertyKeys)
- public GraphTraversal<S, IDictionary<string, E2>> ValueMap<E2> (params string[] propertyKeys)
++ public GraphTraversal<S, IDictionary<TKey, TValue>> ValueMap<TKey, TValue> (params string[] propertyKeys)
{
var args = new List<object>(0 + propertyKeys.Length) {};
args.AddRange(propertyKeys);
Bytecode.AddStep("valueMap", args.ToArray());
- return Wrap< S , IDictionary<TKey, TValue> >(this);
- return Wrap<S, IDictionary<string, E2>>(this);
++ return Wrap<S, IDictionary<TKey, TValue>>(this);
}
/// <summary>
/// Adds the valueMap step to this <see cref="GraphTraversal{SType, EType}" />.
/// </summary>
- public GraphTraversal< S , IDictionary<TKey, TValue> > ValueMap<TKey, TValue> (bool includeTokens, params string[] propertyKeys)
- public GraphTraversal<S, IDictionary<string, E2>> ValueMap<E2> (bool includeTokens, params string[] propertyKeys)
++ public GraphTraversal<S, IDictionary<TKey, TValue>> ValueMap<TKey, TValue> (bool includeTokens, params string[] propertyKeys)
{
var args = new List<object>(1 + propertyKeys.Length) {includeTokens};
args.AddRange(propertyKeys);
Bytecode.AddStep("valueMap", args.ToArray());
- return Wrap< S , IDictionary<TKey, TValue> >(this);
- return Wrap<S, IDictionary<string, E2>>(this);
++ return Wrap<S, IDictionary<TKey, TValue>>(this);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a62a0111/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 9453505,2cbe4de..8971fab
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@@ -210,28 -210,6 +210,28 @@@ namespace Gremlin.Net.Process.Traversa
}
/// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addE step to that
+ /// traversal.
+ /// </summary>
- public GraphTraversal< Edge,Edge > AddE(string label)
++ public GraphTraversal<Edge, Edge> AddE(string label)
+ {
- var traversal = new GraphTraversal< Edge,Edge >(TraversalStrategies, new Bytecode(Bytecode));
++ var traversal = new GraphTraversal<Edge, Edge>(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addE", label);
+ return traversal;
+ }
+
+ /// <summary>
+ /// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addE step to that
+ /// traversal.
+ /// </summary>
- public GraphTraversal< Edge,Edge > AddE(ITraversal edgeLabelTraversal)
++ public GraphTraversal<Edge, Edge> AddE(ITraversal edgeLabelTraversal)
+ {
- var traversal = new GraphTraversal< Edge,Edge >(TraversalStrategies, new Bytecode(Bytecode));
++ var traversal = new GraphTraversal<Edge, Edge>(TraversalStrategies, new Bytecode(Bytecode));
+ traversal.Bytecode.AddStep("addE", edgeLabelTraversal);
+ return traversal;
+ }
+
+ /// <summary>
/// Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the addV step to that
/// traversal.
/// </summary>
@@@ -246,10 -224,12 +246,10 @@@
/// 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)
++ public GraphTraversal<Vertex, Vertex> AddV(string label)
{
- var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
+ var traversal = new GraphTraversal<Vertex, Vertex>(TraversalStrategies, new Bytecode(Bytecode));
- var args = new List<object>(0 + keyValues.Length) {};
- args.AddRange(keyValues);
- traversal.Bytecode.AddStep("addV", args.ToArray());
+ traversal.Bytecode.AddStep("addV", label);
return traversal;
}
@@@ -257,10 -237,10 +257,10 @@@
/// 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(ITraversal vertexLabelTraversal)
- public GraphTraversal<Vertex, Vertex> AddV(string label)
++ public GraphTraversal<Vertex, Vertex> AddV(ITraversal vertexLabelTraversal)
{
- var traversal = new GraphTraversal< Vertex,Vertex >(TraversalStrategies, new Bytecode(Bytecode));
+ var traversal = new GraphTraversal<Vertex, Vertex>(TraversalStrategies, new Bytecode(Bytecode));
- traversal.Bytecode.AddStep("addV", label);
+ traversal.Bytecode.AddStep("addV", vertexLabelTraversal);
return traversal;
}