< Summary

Class:Itinero.Data.Usage.DataUseNotifier
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Data/Usage/DataUseNotifier.cs
Covered lines:10
Uncovered lines:9
Coverable lines:19
Total lines:51
Line coverage:52.6% (10 of 19)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor()100%1100%
AddListener(...)100%10%
get_RegisteredListeners()100%1100%
NotifyVertex()50%250%
NotifyBox()50%250%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Data/Usage/DataUseNotifier.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Threading;
 5using System.Threading.Tasks;
 6using Itinero.Network;
 7
 8namespace Itinero.Data.Usage;
 9
 10/// <summary>
 11/// Notifies listeners about data use in a router db.
 12/// </summary>
 13public class DataUseNotifier
 14{
 29615    private readonly HashSet<IDataUseListener> _listeners = new();
 16
 17    /// <summary>
 18    /// Adds a new listener.
 19    /// </summary>
 20    /// <param name="listener">The new listener.</param>
 21    public void AddListener(IDataUseListener listener)
 022    {
 023        _listeners.Add(listener);
 024    }
 25
 26    internal IEnumerable<IDataUseListener> RegisteredListeners
 27    {
 28        get
 11929        {
 11930            return _listeners.ToList();
 11931        }
 32    }
 33
 34    internal async Task NotifyVertex(RoutingNetwork network, VertexId vertex, CancellationToken cancellationToken = defa
 6735    {
 20136        foreach (var listener in _listeners)
 037        {
 038            await listener.VertexTouched(network, vertex, cancellationToken);
 039        }
 6740    }
 41
 42    internal async Task NotifyBox(RoutingNetwork network,
 43        ((double longitude, double latitude, float? e) topLeft, (double longitude, double latitude, float? e)
 44            bottomRight) box, CancellationToken cancellationToken = default)
 2145    {
 6346        foreach (var listener in _listeners)
 047        {
 048            await listener.BoxTouched(network, box, cancellationToken);
 049        }
 2150    }
 51}