< Summary

Information
Class: GridForge.Grids.GridNavigationBodyTraceScratch
Assembly: GridForge
File(s): /home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridNavigationBodyTraceScratch.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 40
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Clear()100%11100%

File(s)

/home/runner/work/GridForge/GridForge/src/GridForge/Grids/Support/GridNavigationBodyTraceScratch.cs

#LineLine coverage
 1//=======================================================================
 2// GridNavigationBodyTraceScratch.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 SwiftCollections;
 9
 10namespace GridForge.Grids;
 11
 12/// <summary>Owns reusable caller-side storage for allocation-free warmed navigation-body traces.</summary>
 13/// <remarks>Instances retain capacity and are not thread-safe.</remarks>
 14public sealed class GridNavigationBodyTraceScratch
 15{
 16    internal SwiftList<ushort> CandidateGrids { get; }
 17
 18    internal SwiftList<GridNavigationBodyTraceCandidate> AddressCandidates { get; }
 19
 20    internal SwiftList<int> UnionMembers { get; }
 21
 22    /// <summary>Creates scratch with expected grid and address counts.</summary>
 15523    public GridNavigationBodyTraceScratch(int gridCapacity = 0, int addressCapacity = 0)
 24    {
 15525        ChronicleGuard.ThrowIfNegative(gridCapacity, nameof(gridCapacity));
 15526        ChronicleGuard.ThrowIfNegative(addressCapacity, nameof(addressCapacity));
 27
 15528        CandidateGrids = new SwiftList<ushort>(gridCapacity);
 15529        AddressCandidates = new SwiftList<GridNavigationBodyTraceCandidate>(addressCapacity);
 15530        UnionMembers = new SwiftList<int>(addressCapacity);
 15531    }
 32
 33    /// <summary>Clears temporary values while retaining capacity.</summary>
 34    public void Clear()
 35    {
 91836        CandidateGrids.Clear();
 91837        AddressCandidates.Clear();
 91838        UnionMembers.Clear();
 91839    }
 40}