< 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:251_23667616543

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
 639    public EdgeFactorCache()
 6310    {
 6311        _cache = new EdgeFactor?[1024];
 6312    }
 13
 14    public EdgeFactor? Get(uint edgeTypeId)
 107101215    {
 107101216        if (_cache.Length <= edgeTypeId)
 217        {
 218            return null;
 19        }
 20
 107101021        return _cache[edgeTypeId];
 107101222    }
 23
 24    public void Set(uint edgeTypeId, EdgeFactor factor)
 181325    {
 181326        var cache = _cache;
 181327        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
 181143        cache[edgeTypeId] = factor;
 181344    }
 45}

Methods/Properties

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