< Summary

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

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// NavigationSelectedEdgeRef.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 canonical outgoing edge without retaining snapshot-local state.</summary>
 14internal readonly struct NavigationSelectedEdgeRef : IEquatable<NavigationSelectedEdgeRef>
 15{
 16    internal NavigationSelectedEdgeRef(
 17        NavigationCellAddress target,
 18        TraversalMedium targetMedium,
 19        int canonicalOutgoingOrdinal)
 20    {
 21        System.Diagnostics.Debug.Assert(NavigationCell.IsKnownMedium(targetMedium));
 29197222        Target = target;
 29197223        TargetMedium = targetMedium;
 29197224        CanonicalOutgoingOrdinal = canonicalOutgoingOrdinal;
 29197225    }
 26
 27    internal NavigationCellAddress Target { get; }
 28
 29    internal TraversalMedium TargetMedium { get; }
 30
 31    internal int CanonicalOutgoingOrdinal { get; }
 32
 15533    internal bool IsValid => !string.IsNullOrEmpty(Target.MapId)
 15534        && CanonicalOutgoingOrdinal >= 0;
 35
 36    public bool Equals(NavigationSelectedEdgeRef other) =>
 12237        Target.Equals(other.Target)
 12238        && TargetMedium == other.TargetMedium
 12239        && CanonicalOutgoingOrdinal == other.CanonicalOutgoingOrdinal;
 40
 10000541    public override int GetHashCode() => SwiftHashTools.CombineHashCodes(
 10000542        SwiftHashTools.CombineHashCodes(Target.GetHashCode(), (int)TargetMedium),
 10000543        CanonicalOutgoingOrdinal);
 44
 45}