< Summary

Class:Itinero.Network.Tiles.Standalone.Global.GlobalEdgeId
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Network/Tiles/Standalone/Global/GlobalEdgeId.cs
Covered lines:30
Uncovered lines:9
Coverable lines:39
Total lines:88
Line coverage:76.9% (30 of 39)
Covered branches:8
Total branches:14
Branch coverage:57.1% (8 of 14)
Tag:284_38118444584

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
Create(...)50%4100%
Create(...)50%4100%
get_EdgeId()100%1100%
get_Tail()100%1100%
get_Head()100%1100%
GetInverted()100%1100%
ToString()100%10%
Equals(...)100%4100%
Equals(...)0%20%
GetHashCode()100%1100%
op_Equality(...)100%1100%
op_Inequality(...)100%10%

File(s)

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

#LineLine coverage
 1using System;
 2
 3namespace Itinero.Network.Tiles.Standalone.Global;
 4
 5/// <summary>
 6/// A global edge id.
 7/// </summary>
 8public readonly struct GlobalEdgeId : IEquatable<GlobalEdgeId>
 9{
 10
 11    private GlobalEdgeId(long edgeId, ushort tail, ushort head)
 209164612    {
 209164613        this.EdgeId = edgeId;
 209164614        this.Tail = tail;
 209164615        this.Head = head;
 209164616    }
 17
 18    public static GlobalEdgeId Create(long edgeId, uint tail, uint head)
 922619    {
 922620        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 922621        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 22
 922623        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 922624    }
 25
 26    public static GlobalEdgeId Create(long edgeId, int tail, int head)
 133307727    {
 133307728        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 133307729        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 30
 133307731        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 133307732    }
 33
 34    /// <summary>
 35    /// The edge id, the way id when using OSM.
 36    /// </summary>
 308775437    public long EdgeId { get; }
 38
 39    /// <summary>
 40    /// The tail, the index of first node in the way representing the segment when using OSM.
 41    /// </summary>
 237151442    public ushort Tail { get; }
 43
 44    /// <summary>
 45    /// The tail, the index of last node in the way representing the segment when using OSM.
 46    /// </summary>
 235856647    public ushort Head { get; }
 48
 49    /// <summary>
 50    /// Gets the inverted edge, tail and head switched.
 51    /// </summary>
 52    /// <returns></returns>
 53    public GlobalEdgeId GetInverted()
 74934354    {
 74934355        return new GlobalEdgeId(this.EdgeId, this.Head, this.Tail);
 74934356    }
 57
 58    /// <inheritdoc />
 59    public override string ToString()
 060    {
 061        return $"{this.EdgeId}_{this.Tail}->{this.Head}";
 062    }
 63
 64    public bool Equals(GlobalEdgeId other)
 3839265    {
 3839266        return this.EdgeId == other.EdgeId && this.Tail == other.Tail && this.Head == other.Head;
 3839267    }
 68
 69    public override bool Equals(object? obj)
 070    {
 071        return obj is GlobalEdgeId other && this.Equals(other);
 072    }
 73
 74    public override int GetHashCode()
 85791175    {
 85791176        return HashCode.Combine(this.EdgeId, this.Tail, this.Head);
 85791177    }
 78
 79    public static bool operator ==(GlobalEdgeId left, GlobalEdgeId right)
 1837180    {
 1837181        return left.Equals(right);
 1837182    }
 83
 84    public static bool operator !=(GlobalEdgeId left, GlobalEdgeId right)
 085    {
 086        return !left.Equals(right);
 087    }
 88}