< Summary

Information
Class: Trailblazer.Pathing.NavigationConnectionOwnerKey
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationConnectionOwnerKey.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 43
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
CompareTo(...)100%22100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationConnectionOwnerKey.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationConnectionOwnerKey.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2024-present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9using SwiftCollections.Utility;
 10
 11namespace Trailblazer.Pathing;
 12
 13/// <summary>Identifies one source-map-owned explicit connection.</summary>
 14internal readonly struct NavigationConnectionOwnerKey : IEquatable<NavigationConnectionOwnerKey>, IComparable<Navigation
 15{
 16    internal NavigationConnectionOwnerKey(string mapId, string connectionId)
 17    {
 2631118        MapId = mapId;
 2631119        ConnectionId = connectionId;
 2631120    }
 21
 22    internal string MapId { get; }
 23
 24    internal string ConnectionId { get; }
 25
 26    public int CompareTo(NavigationConnectionOwnerKey other)
 27    {
 5228        int map = string.CompareOrdinal(MapId, other.MapId);
 5229        return map != 0 ? map : string.CompareOrdinal(ConnectionId, other.ConnectionId);
 30    }
 31
 32    public bool Equals(NavigationConnectionOwnerKey other) =>
 433        string.Equals(MapId, other.MapId, StringComparison.Ordinal)
 434        && string.Equals(ConnectionId, other.ConnectionId, StringComparison.Ordinal);
 35
 36    public override int GetHashCode()
 37    {
 538        var comparer = SwiftHashTools.GetDeterministicStringEqualityComparer();
 539        return SwiftHashTools.CombineHashCodes(
 540            comparer.GetHashCode(MapId),
 541            comparer.GetHashCode(ConnectionId));
 42    }
 43}