< Summary

Class:Itinero.Routing.Costs.PocketCostFunction
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Routing/Costs/PocketCostFunction.cs
Covered lines:10
Uncovered lines:0
Coverable lines:10
Total lines:35
Line coverage:100% (10 of 10)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)
Tag:284_38118444584

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
Get(...)50%4100%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Routing/Costs/PocketCostFunction.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using Itinero.Network;
 3using Itinero.Network.Enumerators.Edges;
 4using Itinero.Routing.Flavours.Dijkstra;
 5
 6namespace Itinero.Routing.Costs;
 7
 8/// <summary>
 9/// Reports the edges of a local pocket as local-access, whatever their tags say.
 10/// </summary>
 11/// <remarks>
 12/// An untagged segment enclosed by access=destination edges behaves as part of the pocket, so the
 13/// L to L, L to N, N to N rule carries a half through it instead of stopping at it.
 14/// </remarks>
 15internal sealed class PocketCostFunction : ICostFunction
 16{
 17    private readonly ICostFunction _inner;
 18    private readonly HashSet<EdgeId> _members;
 19
 320    public PocketCostFunction(ICostFunction inner, HashSet<EdgeId> members)
 321    {
 322        _inner = inner;
 323        _members = members;
 324    }
 25
 26    public (bool canAccess, bool canStop, bool localAccess, double cost, double turnCost) Get(
 27        IEdgeEnumerator<RoutingNetwork> edgeEnumerator, bool tailToHead = true,
 28        PreviousEdgeEnumerable previousEdges = default)
 729    {
 730        var inner = _inner.Get(edgeEnumerator, tailToHead, previousEdges);
 731        if (inner.localAccess || !_members.Contains(edgeEnumerator.EdgeId)) return inner;
 32
 733        return (inner.canAccess, inner.canStop, true, inner.cost, inner.turnCost);
 734    }
 35}

Methods/Properties

.ctor(...)
Get(...)