Example #1
0
        /// <summary>
        /// Set the configuration of the route based on a graph path.
        /// </summary>
        /// <param name="route">Target route</param>
        /// <param name="path">Graph path</param>
        private void SetupRoute(IRoute route, IPath<string> path)
        {
            // Precondition
            Contract.Requires(path != null, "Valid path (!= null)");
            var edges = path.GetEdges();
            Contract.Requires(edges.Count() > 0, "Valid path (not empty)");

            // Set the route
            foreach (var edge in edges)
            {
                // Get link
                var link = GetLink(edge.StartVertex.Label, edge.FinalVertex.Label);

                // Check link...
                Contract.Assert(link != null, "Valid link");

                // Setup route
                route.AddLink(link);
            }
        }