コード例 #1
0
 public bool Contains(RouteNode node)
 {
     if (End == node)
     {
         return(true);
     }
     return(StartRoute != null && StartRoute.Contains(node));
 }
コード例 #2
0
        private RouteEdge GetEdge(RouteNode startNode, RouteNode endNode)
        {
            foreach (var edge in _edges[startNode])
            {
                if (edge.End == endNode)
                {
                    return(edge);
                }
            }

            throw new InvalidOperationException($"Route from {startNode} to {endNode} is not available.");
        }
コード例 #3
0
 public RouteEdge(RouteNode start, RouteNode end, int distance)
 {
     this.Start    = start;
     this.End      = end;
     this.Distance = distance;
 }
コード例 #4
0
 public IEnumerable <Route> Walk(RouteNode startNode, Func <Route, bool> routeVisitor)
 {
     return(Walk(Route.CreateStart(startNode), routeVisitor));
 }
コード例 #5
0
 internal static Route CreateStart(RouteNode startNode)
 {
     return(new Route(startNode, null, 0));
 }
コード例 #6
0
 private Route(RouteNode endNode, Route startRoute, int distance)
 {
     StartRoute = startRoute;
     End        = endNode;
     Distance   = distance;
 }