public NavigationContext(PathSpecification pathSpecification, UrlFormatting urlFormatting, int maxLevel, bool stripIndexHtm) : this() { PathSpecification = pathSpecification; UrlFormatting = urlFormatting; MaxLevel = maxLevel; StripIndexHtm = stripIndexHtm; }
public void GetPathsByVertexIntegrationTest() { Assert.Inconclusive("TODO."); IGraphService target = CreateIGraphService(); // TODO: Initialize to an appropriate value string vertexIdentifier = string.Empty; // TODO: Initialize to an appropriate value string to = string.Empty; // TODO: Initialize to an appropriate value PathSpecification definition = null; // TODO: Initialize to an appropriate value List <PathREST> expected = null; // TODO: Initialize to an appropriate value List <PathREST> actual; actual = target.GetPathsByVertex(vertexIdentifier, to, definition); Assert.AreEqual(expected, actual); }
public void GetPathsByVertexUnitTest() { Assert.Inconclusive("TODO"); Fallen8 fallen8 = null; // TODO: Initialize to an appropriate value var target = new GraphService(fallen8); // TODO: Initialize to an appropriate value string from = string.Empty; // TODO: Initialize to an appropriate value string to = string.Empty; // TODO: Initialize to an appropriate value PathSpecification definition = null; // TODO: Initialize to an appropriate value List <PathREST> expected = null; // TODO: Initialize to an appropriate value List <PathREST> actual; actual = target.GetPathsByVertex(from, to, definition); Assert.AreEqual(expected, actual); }
public List <PathREST> GetPaths(string from, string to, PathSpecification definition) { if (definition != null) { var fromId = Convert.ToInt32(from); var toId = Convert.ToInt32(to); var results = _codeProvider.CompileAssemblyFromSource(_compilerParameters, new[] { CreateSource(definition) }); if (results.Errors.HasErrors) { throw new Exception(CreateErrorMessage(results.Errors)); } var type = results.CompiledAssembly.GetType(PathDelegateClassName); var edgeCostDelegate = CreateEdgeCostDelegate(definition.Cost, type); var vertexCostDelegate = CreateVertexCostDelegate(definition.Cost, type); var edgePropertyFilterDelegate = CreateEdgePropertyFilterDelegate(definition.Filter, type); var vertexFilterDelegate = CreateVertexFilterDelegate(definition.Filter, type); var edgeFilterDelegate = CreateEdgeFilterDelegate(definition.Filter, type); List <Path> paths; if (_fallen8.CalculateShortestPath( out paths, definition.PathAlgorithmName, fromId, toId, definition.MaxDepth, definition.MaxPathWeight, definition.MaxResults, edgePropertyFilterDelegate, vertexFilterDelegate, edgeFilterDelegate, edgeCostDelegate, vertexCostDelegate)) { if (paths != null) { return(new List <PathREST>(paths.Select(aPath => new PathREST(aPath)))); } } } return(null); }
/// <summary> /// Create the source for the code generation /// </summary> /// <param name="definition">The path specification</param> /// <returns>The source code</returns> private string CreateSource(PathSpecification definition) { if (definition == null) { return(string.Empty); } var sb = new StringBuilder(); sb.AppendLine(_pathDelegateClassPrefix); if (definition.Cost != null) { if (definition.Cost.Edge != null) { sb.AppendLine(definition.Cost.Edge); } if (definition.Cost.Vertex != null) { sb.AppendLine(definition.Cost.Vertex); } } if (definition.Filter != null) { if (definition.Filter.Edge != null) { sb.AppendLine(definition.Filter.Edge); } if (definition.Filter.EdgeProperty != null) { sb.AppendLine(definition.Filter.EdgeProperty); } if (definition.Filter.Vertex != null) { sb.AppendLine(definition.Filter.Vertex); } } sb.AppendLine(_pathDelegateClassSuffix); return(sb.ToString()); }
public LayoutPath CreateLayoutPath(string pathString) { var edgeSpecifications = PathSpecification.Parse(pathString).ToEdgeSpecifications(); return(new LayoutPath(edgeSpecifications.Select(CreateLayoutEdge))); }
public List <PathREST> GetPathsByVertex(string from, string to, PathSpecification definition) { return(GetPaths(from, to, definition)); }
protected virtual PathSpecification GetPathSpecification(string pathString) { return(PathSpecification.Parse(pathString)); }