< Summary

Information
Class: GridForge.Grids.Topology.GridCoveredAddressRunStamp
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Topology/GridCoveredAddressRunStamp.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 63
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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%11100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Topology/GridCoveredAddressRunStamp.cs

#LineLine coverage
 1//=======================================================================
 2// GridCoveredAddressRunStamp.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 GridForge.Grids.Topology;
 12
 13/// <summary>Identifies the exact committed world revision bound by a covered-address cursor.</summary>
 14public readonly struct GridCoveredAddressRunStamp : IEquatable<GridCoveredAddressRunStamp>
 15{
 16    /// <summary>The process-unique world allocation identity.</summary>
 17    public long WorldSpawnToken { get; }
 18
 19    /// <summary>The world-local structural generation.</summary>
 20    public uint WorldVersion { get; }
 21
 22    /// <summary>The committed world-local change sequence.</summary>
 23    public ulong ChangeSequence { get; }
 24
 25    internal GridCoveredAddressRunStamp(
 26        long worldSpawnToken,
 27        uint worldVersion,
 28        ulong changeSequence)
 29    {
 5330        WorldSpawnToken = worldSpawnToken;
 5331        WorldVersion = worldVersion;
 5332        ChangeSequence = changeSequence;
 5333    }
 34
 35    /// <inheritdoc />
 36    public bool Equals(GridCoveredAddressRunStamp other) =>
 1337        WorldSpawnToken == other.WorldSpawnToken
 1338        && WorldVersion == other.WorldVersion
 1339        && ChangeSequence == other.ChangeSequence;
 40
 41    /// <inheritdoc />
 42    public override bool Equals(object? obj) =>
 343        obj is GridCoveredAddressRunStamp other && Equals(other);
 44
 45    /// <inheritdoc />
 46    public override int GetHashCode()
 47    {
 248        int hash = SwiftHashTools.CombineHashCodes(
 249            WorldSpawnToken.GetHashCode(),
 250            WorldVersion.GetHashCode());
 251        return SwiftHashTools.CombineHashCodes(hash, ChangeSequence.GetHashCode());
 52    }
 53
 54    /// <inheritdoc />
 55    public static bool operator ==(
 56        GridCoveredAddressRunStamp left,
 257        GridCoveredAddressRunStamp right) => left.Equals(right);
 58
 59    /// <inheritdoc />
 60    public static bool operator !=(
 61        GridCoveredAddressRunStamp left,
 162        GridCoveredAddressRunStamp right) => !left.Equals(right);
 63}