< Summary

Information
Class: Trailblazer.Pathing.NavigationFlowFieldPayloadKey
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/Flow/NavigationFlowFieldPayloadKey.cs
Line coverage
100%
Covered lines: 34
Uncovered lines: 0
Coverable lines: 34
Total lines: 75
Line coverage: 100%
Branch coverage
100%
Covered branches: 18
Total branches: 18
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%1818100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/Flow/NavigationFlowFieldPayloadKey.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationFlowFieldPayloadKey.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 destination-centric flow field independently of origin.</summary>
 14internal readonly struct NavigationFlowFieldPayloadKey :
 15    IEquatable<NavigationFlowFieldPayloadKey>
 16{
 17    internal NavigationFlowFieldPayloadKey(
 18        PathQuery query,
 19        NavigationCellAddress destinationAddress,
 20        TraversalMedium startMedium,
 21        TraversalMedia targetMedia)
 22    {
 77423        Destination = query.End;
 77424        DestinationAddress = destinationAddress;
 77425        _startMedium = (byte)startMedium;
 77426        _targetMedia = (byte)targetMedia;
 77427        Agent = query.Agent;
 77428        AreaPolicy = query.AreaPolicy;
 77429        Traversal = query.Traversal;
 77430        Budget = query.Budget;
 77431        AllowTransitions = query.AllowTransitions;
 77432        FlowField = query.FlowField;
 77433    }
 34
 35    internal NavigationEndpoint Destination { get; }
 36    internal NavigationCellAddress DestinationAddress { get; }
 37    internal NavigationAgentProfile Agent { get; }
 38    internal NavigationAreaPolicyKey AreaPolicy { get; }
 39    internal TraversalIntent Traversal { get; }
 40    internal NavigationWorkBudget Budget { get; }
 41    internal bool AllowTransitions { get; }
 42    private readonly byte _startMedium;
 43    private readonly byte _targetMedia;
 880644    internal TraversalMedium StartMedium => (TraversalMedium)_startMedium;
 480945    internal TraversalMedia TargetMedia => (TraversalMedia)_targetMedia;
 46    internal FlowFieldQueryOptions FlowField { get; }
 47
 48    public bool Equals(NavigationFlowFieldPayloadKey other) =>
 143249        Destination == other.Destination
 143250        && DestinationAddress == other.DestinationAddress
 143251        && StartMedium == other.StartMedium
 143252        && TargetMedia == other.TargetMedia
 143253        && Agent == other.Agent
 143254        && AreaPolicy == other.AreaPolicy
 143255        && Traversal == other.Traversal
 143256        && Budget == other.Budget
 143257        && AllowTransitions == other.AllowTransitions
 143258        && FlowField == other.FlowField;
 59
 60    public override int GetHashCode()
 61    {
 193862        int hash = SwiftHashTools.CombineHashCodes(
 193863            Destination.GetHashCode(),
 193864            DestinationAddress.GetHashCode());
 193865        hash = SwiftHashTools.CombineHashCodes(hash, (int)StartMedium);
 193866        hash = SwiftHashTools.CombineHashCodes(hash, (int)TargetMedia);
 193867        hash = SwiftHashTools.CombineHashCodes(hash, Agent.GetHashCode());
 193868        hash = SwiftHashTools.CombineHashCodes(hash, AreaPolicy.GetHashCode());
 193869        hash = SwiftHashTools.CombineHashCodes(hash, Traversal.GetHashCode());
 193870        hash = SwiftHashTools.CombineHashCodes(hash, Budget.GetHashCode());
 193871        hash = SwiftHashTools.CombineHashCodes(hash, AllowTransitions ? 1 : 0);
 193872        return SwiftHashTools.CombineHashCodes(hash, FlowField.GetHashCode());
 73    }
 74
 75}