< 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: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 66
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%
Equals(...)50%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
 1using System;
 2
 3namespace SwiftCollections.Query;
 4
 5/// <summary>
 6/// Represents an integer cell coordinate in a spatial hash grid.
 7/// </summary>
 8public readonly struct SwiftSpatialHashCellIndex : IEquatable<SwiftSpatialHashCellIndex>
 9{
 10    /// <summary>
 11    /// Initializes a new instance of the <see cref="SwiftSpatialHashCellIndex"/> struct.
 12    /// </summary>
 13    public SwiftSpatialHashCellIndex(int x, int y, int z)
 14    {
 90515        X = x;
 90516        Y = y;
 90517        Z = z;
 90518    }
 19
 20    /// <summary>
 21    /// Gets the X-axis cell coordinate.
 22    /// </summary>
 194623    public int X { get; }
 24
 25    /// <summary>
 26    /// Gets the Y-axis cell coordinate.
 27    /// </summary>
 219428    public int Y { get; }
 29
 30    /// <summary>
 31    /// Gets the Z-axis cell coordinate.
 32    /// </summary>
 297833    public int Z { get; }
 34
 35    /// <inheritdoc />
 36    public bool Equals(SwiftSpatialHashCellIndex other)
 37    {
 21738        return X == other.X && Y == other.Y && Z == other.Z;
 39    }
 40
 41    /// <inheritdoc />
 242    public override bool Equals(object? obj) => obj is SwiftSpatialHashCellIndex other && Equals(other);
 43
 44    /// <summary>
 45    /// Determines whether two SwiftSpatialHashCellIndex instances are equal.
 46    /// </summary>
 247    public static bool operator ==(SwiftSpatialHashCellIndex left, SwiftSpatialHashCellIndex right) => left.Equals(right
 48
 49    /// <summary>
 50    /// Determines whether two SwiftSpatialHashCellIndex instances are not equal.
 51    /// </summary>
 152    public static bool operator !=(SwiftSpatialHashCellIndex left, SwiftSpatialHashCellIndex right) => !left.Equals(righ
 53
 54    /// <inheritdoc />
 124555    public override int GetHashCode() => HashCode.Combine(X, Y, Z);
 56
 57    /// <summary>
 58    /// Returns a string that represents the current object in the format "(X, Y, Z)".
 59    /// </summary>
 60    /// <remarks>
 61    /// This method is useful for debugging or logging purposes to quickly view the values of the
 62    /// object's coordinates.
 63    /// </remarks>
 64    /// <returns>A string representation of the object, showing the values of X, Y, and Z in parentheses and separated b
 165    public override string ToString() => $"({X}, {Y}, {Z})";
 66}