< Summary

Class:Itinero.Routing.Costs.Caches.EdgeFactorCache
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Routing/Costs/Caches/EdgeFactorCache.cs
Covered lines:26
Uncovered lines:0
Coverable lines:26
Total lines:45
Line coverage:100% (26 of 26)
Covered branches:6
Total branches:6
Branch coverage:100% (6 of 6)
Tag:284_38118444584

Metrics

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

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Routing/Costs/Caches/EdgeFactorCache.cs

#LineLine coverage
 1using Itinero.Profiles;
 2
 3namespace Itinero.Routing.Costs.Caches;
 4
 5internal class EdgeFactorCache
 6{
 7    private EdgeFactor?[] _cache;
 8
 949    public EdgeFactorCache()
 9410    {
 9411        _cache = new EdgeFactor?[1024];
 9412    }
 13
 14    public EdgeFactor? Get(uint edgeTypeId)
 109661815    {
 109661816        if (_cache.Length <= edgeTypeId)
 217        {
 218            return null;
 19        }
 20
 109661621        return _cache[edgeTypeId];
 109661822    }
 23
 24    public void Set(uint edgeTypeId, EdgeFactor factor)
 182825    {
 182826        var cache = _cache;
 182827        if (cache.Length <= edgeTypeId)
 228        {
 229            var newSize = _cache.Length + 1024;
 330            while (newSize <= edgeTypeId)
 131            {
 132                newSize += 1024;
 133            }
 34
 235            var newCache = new EdgeFactor?[newSize];
 236            cache.CopyTo(newCache, 0);
 37
 238            newCache[edgeTypeId] = factor;
 239            _cache = newCache;
 240            return;
 41        }
 42
 182643        cache[edgeTypeId] = factor;
 182844    }
 45}

Methods/Properties

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