< Summary

Information
Class: Trailblazer.Pathing.NavigationMapCheckpointStamp
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Map/Operations/NavigationMapCheckpointStamp.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 64
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%
Equals(...)100%44100%
Equals(...)100%22100%
GetHashCode()100%22100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Map/Operations/NavigationMapCheckpointStamp.cs

#LineLine coverage
 1//=======================================================================
 2// NavigationMapCheckpointStamp.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>
 14/// Identifies the exact bake and overlay prefix captured by a checkpoint rebake.
 15/// </summary>
 16public readonly struct NavigationMapCheckpointStamp : IEquatable<NavigationMapCheckpointStamp>
 17{
 18    /// <summary>Initializes an immutable checkpoint base stamp.</summary>
 19    public NavigationMapCheckpointStamp(string mapId, long bakeVersion, long overlayHighWaterSequence)
 20    {
 1021        SwiftThrowHelper.ThrowIfNull(mapId, nameof(mapId));
 1022        SwiftThrowHelper.ThrowIfArgument(string.IsNullOrWhiteSpace(mapId), nameof(mapId));
 1023        SwiftThrowHelper.ThrowIfArgument(bakeVersion <= 0, nameof(bakeVersion));
 1024        SwiftThrowHelper.ThrowIfArgument(overlayHighWaterSequence < 0, nameof(overlayHighWaterSequence));
 25
 1026        MapId = mapId;
 1027        BakeVersion = bakeVersion;
 1028        OverlayHighWaterSequence = overlayHighWaterSequence;
 1029    }
 30
 31    /// <summary>Gets the stable map identifier.</summary>
 32    public string MapId { get; }
 33
 34    /// <summary>Gets the exact immutable bake version captured for the checkpoint.</summary>
 35    public long BakeVersion { get; }
 36
 37    /// <summary>Gets the captured overlay operation high-water sequence.</summary>
 38    public long OverlayHighWaterSequence { get; }
 39
 40    /// <inheritdoc/>
 41    public bool Equals(NavigationMapCheckpointStamp other) =>
 642        string.Equals(MapId, other.MapId, StringComparison.Ordinal)
 643        && BakeVersion == other.BakeVersion
 644        && OverlayHighWaterSequence == other.OverlayHighWaterSequence;
 45
 46    /// <inheritdoc/>
 247    public override bool Equals(object? obj) => obj is NavigationMapCheckpointStamp other && Equals(other);
 48
 49    /// <inheritdoc/>
 50    public override int GetHashCode()
 51    {
 452        int mapHash = MapId == null
 453            ? 0
 454            : SwiftHashTools.GetDeterministicStringEqualityComparer().GetHashCode(MapId);
 455        int hash = SwiftHashTools.CombineHashCodes(mapHash, BakeVersion.GetHashCode());
 456        return SwiftHashTools.CombineHashCodes(hash, OverlayHighWaterSequence.GetHashCode());
 57    }
 58
 59    /// <inheritdoc/>
 160    public static bool operator ==(NavigationMapCheckpointStamp left, NavigationMapCheckpointStamp right) => left.Equals
 61
 62    /// <inheritdoc/>
 163    public static bool operator !=(NavigationMapCheckpointStamp left, NavigationMapCheckpointStamp right) => !left.Equal
 64}