< Summary

Information
Class: Trailblazer.Pathing.ReachabilitySnapshotKey
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/Reachability/SolidPartitionReachabilityState.cs
Line coverage
44%
Covered lines: 4
Uncovered lines: 5
Coverable lines: 9
Total lines: 65
Line coverage: 44.4%
Branch coverage
25%
Covered branches: 1
Total branches: 4
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Equals(...)50%22100%
Equals(...)0%620%
GetHashCode()100%210%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/Reachability/SolidPartitionReachabilityState.cs

#LineLine coverage
 1using FixedMathSharp;
 2using GridForge.Spatial;
 3using SwiftCollections;
 4
 5namespace Trailblazer.Pathing;
 6
 7/// <summary>
 8/// Stores conservative solid-partition connectivity snapshots for one pathing context.
 9/// </summary>
 10internal sealed class SolidPartitionReachabilityState
 11{
 12    internal object Lock { get; } = new();
 13
 14    internal SwiftDictionary<WorldVoxelIndex, SolidChartPartition> PassablePartitions { get; } = new();
 15
 16    internal SwiftList<SolidChartPartition> ComponentRoots { get; } = new();
 17
 18    internal SwiftQueue<SolidChartPartition> ComponentQueue { get; } = new();
 19
 20    internal ReachabilitySnapshotKey ActiveSnapshotKey;
 21
 22    internal bool HasActiveSnapshot;
 23
 24    internal int ActiveSnapshotId;
 25
 26    internal int ActiveSnapshotVersion = -1;
 27
 28    internal long SnapshotBuildCount;
 29
 30    internal int Version;
 31}
 32
 33internal readonly struct ReachabilitySnapshotKey : System.IEquatable<ReachabilitySnapshotKey>
 34{
 35    internal ReachabilitySnapshotKey(Fixed64 unitSize, Fixed64 maxClimbHeight)
 36    {
 114537        UnitSize = unitSize;
 114538        MaxClimbHeight = maxClimbHeight;
 114539    }
 40
 41    internal Fixed64 UnitSize { get; }
 42
 43    internal Fixed64 MaxClimbHeight { get; }
 44
 45    public bool Equals(ReachabilitySnapshotKey other)
 46    {
 108947        return UnitSize == other.UnitSize && MaxClimbHeight == other.MaxClimbHeight;
 48    }
 49
 50    public override bool Equals(object? obj)
 51    {
 052        return obj is ReachabilitySnapshotKey other && Equals(other);
 53    }
 54
 55    public override int GetHashCode()
 56    {
 57        unchecked
 58        {
 059            int hash = 17;
 060            hash = (hash * 31) + UnitSize.GetHashCode();
 061            hash = (hash * 31) + MaxClimbHeight.GetHashCode();
 062            return hash;
 63        }
 64    }
 65}