< Summary

Information
Class: SwiftCollections.Query.SwiftSpatialHashOptions
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/SpatialHash/SwiftSpatialHashOptions.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 50
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Default()100%11100%
.ctor(...)100%22100%
get_NeighborhoodPadding()100%11100%
Equals(...)100%11100%
Equals(...)100%22100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%
GetHashCode()100%11100%

File(s)

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

#LineLine coverage
 1using System;
 2
 3namespace SwiftCollections.Query;
 4
 5/// <summary>
 6/// Controls neighborhood query behavior for <see cref="SwiftSpatialHash{TKey, TVolume}"/>.
 7/// </summary>
 8public readonly struct SwiftSpatialHashOptions : IEquatable<SwiftSpatialHashOptions>
 9{
 10    /// <summary>
 11    /// The default options value.
 12    /// </summary>
 1513    public static SwiftSpatialHashOptions Default { get; } = new SwiftSpatialHashOptions(1);
 14
 15    /// <summary>
 16    /// Initializes a new instance of the <see cref="SwiftSpatialHashOptions"/> struct.
 17    /// </summary>
 18    /// <param name="neighborhoodPadding">The number of additional cells to include around neighborhood queries.</param>
 19    public SwiftSpatialHashOptions(int neighborhoodPadding)
 20    {
 721        if (neighborhoodPadding < 0)
 122            throw new ArgumentOutOfRangeException(nameof(neighborhoodPadding), neighborhoodPadding, "Neighborhood paddin
 23
 624        NeighborhoodPadding = neighborhoodPadding;
 625    }
 26
 27    /// <summary>
 28    /// Gets the number of extra cells queried beyond the mapped volume range when using neighborhood queries.
 29    /// </summary>
 1630    public int NeighborhoodPadding { get; }
 31
 32    /// <inheritdoc />
 533    public bool Equals(SwiftSpatialHashOptions other) => NeighborhoodPadding == other.NeighborhoodPadding;
 34
 35    /// <inheritdoc />
 236    public override bool Equals(object? obj) => obj is SwiftSpatialHashOptions other && Equals(other);
 37
 38    /// <summary>
 39    /// Determines whether two SwiftSpatialHashOptions instances are equal.
 40    /// </summary>
 141    public static bool operator ==(SwiftSpatialHashOptions left, SwiftSpatialHashOptions right) => left.Equals(right);
 42
 43    /// <summary>
 44    /// Determines whether two SwiftSpatialHashOptions instances are not equal.
 45    /// </summary>
 146    public static bool operator !=(SwiftSpatialHashOptions left, SwiftSpatialHashOptions right) => !left.Equals(right);
 47
 48    /// <inheritdoc />
 249    public override int GetHashCode() => NeighborhoodPadding;
 50}