Пример #1
0
        /// <summary>
        /// Returns true is the conjunctive part is properly loaded. If a string builder is passed in, and problems are
        /// detected, a description of the problems is added to the StringBuilder.
        /// </summary>
        private bool ConjunctiveRouteProperlyLoaded(Route route, StringBuilder report = null)
        {
            #if DEBUG
            var result = true;
            foreach (var(op0, op1) in route.Operations.Pairwise())
            {
                if (!_graph.ArcExists(op0.Id, op1.Id, -1, out var l))
                {
                    result = false;
                    report?.AppendLine($"Arc {op0.Id} -> {op1.Id} missing.");
                }
                else if (l != op0.Runtime)
                {
                    result = false;
                    report?.AppendLine(
                        $"Arc {op0.Id} -> {op1.Id} should have length {op0.Runtime.Show()}, but has length {l.Show()}.");
                }
            }

            if (result)
            {
                report?.AppendLine($"Route properly loaded.");
            }

            return(result);
            #endif
            return(true);
        }
Пример #2
0
 [Pure] public static bool ArcExists(this IGraph graph, Arc arc, out TimeSpan length) =>
 graph.ArcExists(arc.Tail, arc.Head, arc.MachineId, out length);
Пример #3
0
 [Pure] public static bool ArcExists(this IGraph graph, Arc arc) =>
 graph.ArcExists(arc.Tail, arc.Head, arc.MachineId, out _);
Пример #4
0
 [Pure] public static bool ArcExists(this IGraph graph, int tail, int head, int machineId) =>
 graph.ArcExists(tail, head, machineId, out _);