< Summary

Class:Itinero.Network.Tiles.Standalone.Global.GlobalRestrictionExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/Standalone/Global/GlobalRestrictionExtensions.cs
Covered lines:13
Uncovered lines:0
Coverable lines:13
Total lines:37
Line coverage:100% (13 of 13)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)
Tag:251_23667616543

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
TryBuildNetworkRestriction(...)100%4100%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/Standalone/Global/GlobalRestrictionExtensions.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Diagnostics.CodeAnalysis;
 4
 5namespace Itinero.Network.Tiles.Standalone.Global;
 6
 7public static class GlobalRestrictionExtensions
 8{
 9    /// <summary>
 10    /// Tries to build a network restriction from a global restriction.
 11    /// </summary>
 12    /// <remarks>
 13    /// Should always succeed if all edges are available but can fail if the data available is a tile and does not conta
 14    /// </remarks>
 15    /// <param name="globalNetworkRestriction">The global network.</param>
 16    /// <param name="getEdge">The function to get an edge.</param>
 17    /// <param name="networkRestriction">The resulting network restriction, if any.</param>
 18    /// <returns>True if success, false otherwise.</returns>
 19    public static bool TryBuildNetworkRestriction(this GlobalRestriction globalNetworkRestriction, Func<GlobalEdgeId, (E
 20        [MaybeNullWhen(false)] out NetworkRestriction? networkRestriction)
 475221    {
 475222        networkRestriction = null;
 23
 475224        var edges = new List<(EdgeId edge, bool forward)>();
 2492825        foreach (var globalId in globalNetworkRestriction)
 719626        {
 719627            var e = getEdge(globalId);
 1091628            if (e == null) return false;
 29
 347630            edges.Add(e.Value);
 347631        }
 32
 103233        networkRestriction = new NetworkRestriction(edges, globalNetworkRestriction.IsProhibitory,
 103234            globalNetworkRestriction.Attributes);
 103235        return true;
 475236    }
 37}

Methods/Properties

TryBuildNetworkRestriction(...)