< 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:25
Uncovered lines:14
Coverable lines:39
Total lines:88
Line coverage:64.1% (25 of 39)
Covered branches:6
Total branches:14
Branch coverage:42.8% (6 of 14)
Tag:251_23667616543

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
Create(...)0%40%
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)
 2998912    {
 2998913        this.EdgeId = edgeId;
 2998914        this.Tail = tail;
 2998915        this.Head = head;
 2998916    }
 17
 18    public static GlobalEdgeId Create(long edgeId, uint tail, uint head)
 019    {
 020        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 021        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 22
 023        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 024    }
 25
 26    public static GlobalEdgeId Create(long edgeId, int tail, int head)
 1985327    {
 1985328        if (tail > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(tail));
 1985329        if (head > ushort.MaxValue) throw new ArgumentOutOfRangeException(nameof(head));
 30
 1985331        return new GlobalEdgeId(edgeId, (ushort)tail, (ushort)head);
 1985332    }
 33
 34    /// <summary>
 35    /// The edge id, the way id when using OSM.
 36    /// </summary>
 5417937    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>
 4863142    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>
 4476747    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()
 1013654    {
 1013655        return new GlobalEdgeId(this.EdgeId, this.Head, this.Tail);
 1013656    }
 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)
 1272665    {
 1272666        return this.EdgeId == other.EdgeId && this.Tail == other.Tail && this.Head == other.Head;
 1272667    }
 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()
 1859175    {
 1859176        return HashCode.Combine(this.EdgeId, this.Tail, this.Head);
 1859177    }
 78
 79    public static bool operator ==(GlobalEdgeId left, GlobalEdgeId right)
 922980    {
 922981        return left.Equals(right);
 922982    }
 83
 84    public static bool operator !=(GlobalEdgeId left, GlobalEdgeId right)
 085    {
 086        return !left.Equals(right);
 087    }
 88}