< Summary

Information
Class: Trailblazer.Pathing.NavigationNodeRef
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Graph/NavigationNodeRef.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 48
Line coverage: 100%
Branch coverage
100%
Covered branches: 12
Total branches: 12
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%88100%
get_MapOrdinal()100%11100%
get_CellSlot()100%11100%
get_IsValid()100%22100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

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

#LineLine coverage
 1//=======================================================================
 2// NavigationNodeRef.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 stable cell slot within one immutable graph root.</summary>
 14internal readonly struct NavigationNodeRef : IEquatable<NavigationNodeRef>
 15{
 16    private readonly int _encodedMapOrdinal;
 17    private readonly int _encodedCellSlot;
 18
 19    internal NavigationNodeRef(int mapOrdinal, int cellSlot)
 20    {
 167929021        if (mapOrdinal < 0
 167929022            || mapOrdinal == int.MaxValue
 167929023            || cellSlot < 0
 167929024            || cellSlot == int.MaxValue)
 25        {
 626            _encodedMapOrdinal = 0;
 627            _encodedCellSlot = 0;
 628            return;
 29        }
 30
 167928431        _encodedMapOrdinal = mapOrdinal + 1;
 167928432        _encodedCellSlot = cellSlot + 1;
 167928433    }
 34
 822682735    internal int MapOrdinal => _encodedMapOrdinal - 1;
 36
 702244137    internal int CellSlot => _encodedCellSlot - 1;
 38
 531250939    internal bool IsValid => _encodedMapOrdinal > 0 && _encodedCellSlot > 0;
 40
 41    public bool Equals(NavigationNodeRef other) =>
 61535342        _encodedMapOrdinal == other._encodedMapOrdinal
 61535343        && _encodedCellSlot == other._encodedCellSlot;
 44
 45    public override int GetHashCode() =>
 26317246        SwiftHashTools.CombineHashCodes(_encodedMapOrdinal, _encodedCellSlot);
 47
 48}