< Summary

Information
Class: Trailblazer.Pathing.FlowFieldLocalIndex
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/FlowField/FlowFieldLocalIndex.cs
Line coverage
100%
Covered lines: 17
Uncovered lines: 0
Coverable lines: 17
Total lines: 61
Line coverage: 100%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_X()100%11100%
get_Y()100%11100%
get_Z()100%11100%
FromVoxelIndex(...)100%11100%
Equals(...)50%44100%
Equals(...)100%22100%
GetHashCode()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Pathing/Search/FlowField/FlowFieldLocalIndex.cs

#LineLine coverage
 1using GridForge.Spatial;
 2using System;
 3using System.Runtime.CompilerServices;
 4
 5namespace Trailblazer.Pathing;
 6
 7/// <summary>
 8/// Allocation-free local voxel key for flow-field sampling within one grid.
 9/// </summary>
 10internal readonly struct FlowFieldLocalIndex : IEquatable<FlowFieldLocalIndex>
 11{
 12    private readonly int _x;
 13    private readonly int _y;
 14    private readonly int _z;
 15
 16    public FlowFieldLocalIndex(int x, int y, int z)
 17    {
 182318        _x = x;
 182319        _y = y;
 182320        _z = z;
 182321    }
 22
 181723    public int X => _x;
 24
 181725    public int Y => _y;
 26
 181727    public int Z => _z;
 28
 29    [MethodImpl(MethodImplOptions.AggressiveInlining)]
 30    public static FlowFieldLocalIndex FromVoxelIndex(VoxelIndex index)
 31    {
 181832        return new FlowFieldLocalIndex(index.x, index.y, index.z);
 33    }
 34
 35    /// <inheritdoc/>
 36    public bool Equals(FlowFieldLocalIndex other)
 37    {
 438        return _x == other._x
 439            && _y == other._y
 440            && _z == other._z;
 41    }
 42
 43    /// <inheritdoc/>
 44    public override bool Equals(object? obj)
 45    {
 246        return obj is FlowFieldLocalIndex other && Equals(other);
 47    }
 48
 49    /// <inheritdoc/>
 50    public override int GetHashCode()
 51    {
 52        unchecked
 53        {
 554            int hash = 17;
 555            hash = (hash * 31) + _x;
 556            hash = (hash * 31) + _y;
 557            hash = (hash * 31) + _z;
 558            return hash;
 59        }
 60    }
 61}