< Summary

Information
Class: SwiftCollections.Query.SwiftSpatialHashCellIndex
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/SpatialHash/SwiftSpatialHashCellIndex.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 73
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%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%
GetHashCode()100%11100%
ToString()100%11100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/SpatialHash/SwiftSpatialHashCellIndex.cs

#LineLine coverage
 1//=======================================================================
 2// SwiftSpatialHashCellIndex.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;
 9
 10namespace SwiftCollections.Query;
 11
 12/// <summary>
 13/// Represents an integer cell coordinate in a spatial hash grid.
 14/// </summary>
 15public readonly struct SwiftSpatialHashCellIndex : IEquatable<SwiftSpatialHashCellIndex>
 16{
 17    /// <summary>
 18    /// Initializes a new instance of the <see cref="SwiftSpatialHashCellIndex"/> struct.
 19    /// </summary>
 20    public SwiftSpatialHashCellIndex(int x, int y, int z)
 21    {
 105722        X = x;
 105723        Y = y;
 105724        Z = z;
 105725    }
 26
 27    /// <summary>
 28    /// Gets the X-axis cell coordinate.
 29    /// </summary>
 30    public int X { get; }
 31
 32    /// <summary>
 33    /// Gets the Y-axis cell coordinate.
 34    /// </summary>
 35    public int Y { get; }
 36
 37    /// <summary>
 38    /// Gets the Z-axis cell coordinate.
 39    /// </summary>
 40    public int Z { get; }
 41
 42    /// <inheritdoc />
 43    public bool Equals(SwiftSpatialHashCellIndex other)
 44    {
 24045        return X == other.X && Y == other.Y && Z == other.Z;
 46    }
 47
 48    /// <inheritdoc />
 249    public override bool Equals(object? obj) => obj is SwiftSpatialHashCellIndex other && Equals(other);
 50
 51    /// <summary>
 52    /// Determines whether two SwiftSpatialHashCellIndex instances are equal.
 53    /// </summary>
 254    public static bool operator ==(SwiftSpatialHashCellIndex left, SwiftSpatialHashCellIndex right) => left.Equals(right
 55
 56    /// <summary>
 57    /// Determines whether two SwiftSpatialHashCellIndex instances are not equal.
 58    /// </summary>
 159    public static bool operator !=(SwiftSpatialHashCellIndex left, SwiftSpatialHashCellIndex right) => !left.Equals(righ
 60
 61    /// <inheritdoc />
 152362    public override int GetHashCode() => HashCode.Combine(X, Y, Z);
 63
 64    /// <summary>
 65    /// Returns a string that represents the current object in the format "(X, Y, Z)".
 66    /// </summary>
 67    /// <remarks>
 68    /// This method is useful for debugging or logging purposes to quickly view the values of the
 69    /// object's coordinates.
 70    /// </remarks>
 71    /// <returns>A string representation of the object, showing the values of X, Y, and Z in parentheses and separated b
 172    public override string ToString() => $"({X}, {Y}, {Z})";
 73}