< Summary

Information
Class: Trailblazer.Pathing.NavigationSurfaceComponentKey
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationSurfaceComponentKey.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 46
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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%44100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// NavigationSurfaceComponentKey.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;
 9
 10namespace Trailblazer.Pathing;
 11
 12/// <summary>Identifies one exact weak surface component by its minimum member address.</summary>
 13internal readonly struct NavigationSurfaceComponentKey :
 14    IEquatable<NavigationSurfaceComponentKey>,
 15    IComparable<NavigationSurfaceComponentKey>
 16{
 17    internal NavigationSurfaceComponentKey(
 18        NavigationCellAddress representative,
 19        TraversalMedium medium)
 20    {
 660021        Representative = representative;
 660022        Medium = medium;
 660023    }
 24
 25    internal NavigationCellAddress Representative { get; }
 26
 27    internal TraversalMedium Medium { get; }
 28
 29    public int CompareTo(NavigationSurfaceComponentKey other)
 30    {
 16931        int value = Representative.CompareTo(other.Representative);
 16932        if (value != 0)
 14933            return value;
 2034        int medium = (int)Medium;
 2035        int otherMedium = (int)other.Medium;
 2036        return medium < otherMedium ? -1 : medium > otherMedium ? 1 : 0;
 37    }
 38
 39    public bool Equals(NavigationSurfaceComponentKey other) =>
 215216740        Representative.Equals(other.Representative) && Medium == other.Medium;
 41
 1464242    public override int GetHashCode() => SwiftCollections.Utility.SwiftHashTools.CombineHashCodes(
 1464243        Representative.GetHashCode(),
 1464244        (int)Medium);
 45
 46}