| #region License |
| |
| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| #endregion |
| |
| using System.Collections.Generic; |
| using System.Linq; |
| using Gremlin.Net.Structure; |
| |
| // THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml |
| namespace Gremlin.Net.Process.Traversal |
| { |
| /// <summary> |
| /// Graph traversals are the primary way in which graphs are processed. |
| /// </summary> |
| public class GraphTraversal<S, E> : DefaultTraversal<S, E> |
| { |
| /// <summary> |
| /// Initializes a new instance of the <see cref="GraphTraversal{SType, EType}" /> class. |
| /// </summary> |
| public GraphTraversal() |
| : this(new List<ITraversalStrategy>(), new Bytecode()) |
| { |
| } |
| |
| /// <summary> |
| /// Initializes a new instance of the <see cref="GraphTraversal{SType, EType}" /> class. |
| /// </summary> |
| /// <param name="traversalStrategies">The traversal strategies to be used by this graph traversal at evaluation time.</param> |
| /// <param name="bytecode">The <see cref="Bytecode" /> associated with the construction of this graph traversal.</param> |
| public GraphTraversal(ICollection<ITraversalStrategy> traversalStrategies, Bytecode bytecode) |
| { |
| TraversalStrategies = traversalStrategies; |
| Bytecode = bytecode; |
| } |
| |
| private static GraphTraversal<S2, E2> Wrap<S2, E2>(GraphTraversal<S, E> traversal) |
| { |
| if (typeof(S2) == typeof(S) && typeof(E2) == typeof(E)) |
| { |
| return traversal as GraphTraversal<S2, E2>; |
| } |
| // New wrapper |
| return new GraphTraversal<S2, E2>(traversal.TraversalStrategies, traversal.Bytecode); |
| } |
| |
| <% graphStepMethods.each { method -> %> |
| /// <summary> |
| /// Adds the <%= method.methodName %> step to this <see cref="GraphTraversal{SType, EType}" />. |
| /// </summary> |
| public GraphTraversal<$method.t1, $method.t2> <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %> (<%= method.parameters %>) |
| { |
| <% if (method.parameters.contains("params ")) { |
| %> var args = new List<object>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>}; |
| args.AddRange(<%= method.paramNames.last() %><% if (method.isArgsCastNecessary) { %>.Cast<object>()<% } %>); |
| Bytecode.AddStep("<%= method.methodName %>", args.ToArray());<% |
| } |
| else { |
| %> Bytecode.AddStep("<%= method.methodName %>"<% if (method.parameters) out << ', '+ method.paramNames.join(", ") %>);<% |
| } |
| %> |
| return Wrap<$method.t1, $method.t2>(this); |
| } |
| <% } %> |
| |
| /// <summary> |
| /// Make a copy of a traversal that is reset for iteration. |
| /// </summary> |
| public GraphTraversal<S, E> Clone() |
| { |
| return new GraphTraversal<S, E>(TraversalStrategies, new Bytecode(Bytecode)); |
| } |
| } |
| } |