< 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:263_26948838820

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)
 4549012    {
 4549013        this.EdgeId = edgeId;
 4549014        this.Tail = tail;
 4549015        this.Head = head;
 4549016    }
 17
 18    public static GlobalEdgeId Create(long edgeId, uint tail, uint head)
 8519    {
 8520        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 8521        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 22
 8523        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 8524    }
 25
 26    public static GlobalEdgeId Create(long edgeId, int tail, int head)
 2801227    {
 2801228        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 2801229        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 30
 2801231        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 2801232    }
 33
 34    /// <summary>
 35    /// The edge id, the way id when using OSM.
 36    /// </summary>
 9950537    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>
 9075542    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>
 8685547    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()
 1739354    {
 1739355        return new GlobalEdgeId(this.EdgeId, this.Head, this.Tail);
 1739356    }
 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)
 1898565    {
 1898566        return this.EdgeId == other.EdgeId && this.Tail == other.Tail && this.Head == other.Head;
 1898567    }
 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()
 3619675    {
 3619676        return HashCode.Combine(this.EdgeId, this.Tail, this.Head);
 3619677    }
 78
 79    public static bool operator ==(GlobalEdgeId left, GlobalEdgeId right)
 932380    {
 932381        return left.Equals(right);
 932382    }
 83
 84    public static bool operator !=(GlobalEdgeId left, GlobalEdgeId right)
 085    {
 086        return !left.Equals(right);
 087    }
 88}