< Summary

Information
Class: Trailblazer.Navigation.NavigatorGlobalIdAllocatorState
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/NavigatorGlobalIdAllocatorState.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 41
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
Create()100%11100%
Reset()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/NavigatorGlobalIdAllocatorState.cs

#LineLine coverage
 1//=======================================================================
 2// NavigatorGlobalIdAllocatorState.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 System.Threading;
 10
 11namespace Trailblazer.Navigation;
 12
 13/// <summary>
 14/// Allocates deterministic navigator ids for one Trailblazer world context.
 15/// </summary>
 16internal sealed class NavigatorGlobalIdAllocatorState
 17{
 18    private long _nextId;
 19
 20    internal Guid Create()
 21    {
 26522        long next = Interlocked.Increment(ref _nextId);
 26523        return new Guid(
 26524            unchecked((int)next),
 26525            unchecked((short)(next >> 32)),
 26526            unchecked((short)(next >> 48)),
 26527            (byte)'T',
 26528            (byte)'R',
 26529            (byte)'A',
 26530            (byte)'I',
 26531            (byte)'L',
 26532            (byte)'B',
 26533            (byte)'L',
 26534            (byte)'Z');
 35    }
 36
 37    internal void Reset()
 38    {
 2239        Interlocked.Exchange(ref _nextId, 0);
 2240    }
 41}

Methods/Properties

Create()
Reset()