< Summary

Information
Class: Trailblazer.Pathing.NavigationAStarPayloadKey
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/AStar/NavigationAStarPayloadKey.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 59
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
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_StartMedium()100%11100%
get_TargetMedia()100%11100%
Equals(...)100%88100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/AStar/NavigationAStarPayloadKey.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationAStarPayloadKey.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 exact addressed A* request independently of a graph generation.</summary>
 14internal readonly struct NavigationAStarPayloadKey : IEquatable<NavigationAStarPayloadKey>
 15{
 16    internal NavigationAStarPayloadKey(
 17        PathQuery query,
 18        NavigationCellAddress start,
 19        NavigationCellAddress end,
 20        TraversalMedium startMedium,
 21        TraversalMedia targetMedia)
 22    {
 69523        Query = query;
 69524        Start = start;
 69525        End = end;
 69526        _startMedium = (byte)startMedium;
 69527        _targetMedia = (byte)targetMedia;
 69528    }
 29
 30    internal PathQuery Query { get; }
 31
 32    internal NavigationCellAddress Start { get; }
 33
 34    internal NavigationCellAddress End { get; }
 35
 36    private readonly byte _startMedium;
 37
 38    private readonly byte _targetMedia;
 39
 396340    internal TraversalMedium StartMedium => (TraversalMedium)_startMedium;
 41
 333542    internal TraversalMedia TargetMedia => (TraversalMedia)_targetMedia;
 43
 44    public bool Equals(NavigationAStarPayloadKey other) =>
 98645        Query == other.Query
 98646        && Start == other.Start
 98647        && End == other.End
 98648        && StartMedium == other.StartMedium
 98649        && TargetMedia == other.TargetMedia;
 50
 51    public override int GetHashCode()
 52    {
 143053        int hash = SwiftHashTools.CombineHashCodes(Query.GetHashCode(), Start.GetHashCode());
 143054        hash = SwiftHashTools.CombineHashCodes(hash, End.GetHashCode());
 143055        hash = SwiftHashTools.CombineHashCodes(hash, (int)StartMedium);
 143056        return SwiftHashTools.CombineHashCodes(hash, (int)TargetMedia);
 57    }
 58
 59}