< 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: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 57
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
.ctor(...)100%22100%
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
 1//=======================================================================
 2// SwiftSpatialHashOptions.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/// Controls neighborhood query behavior for <see cref="SwiftSpatialHash{TKey, TVolume}"/>.
 14/// </summary>
 15public readonly struct SwiftSpatialHashOptions : IEquatable<SwiftSpatialHashOptions>
 16{
 17    /// <summary>
 18    /// The default options value.
 19    /// </summary>
 20    public static SwiftSpatialHashOptions Default { get; } = new SwiftSpatialHashOptions(1);
 21
 22    /// <summary>
 23    /// Initializes a new instance of the <see cref="SwiftSpatialHashOptions"/> struct.
 24    /// </summary>
 25    /// <param name="neighborhoodPadding">The number of additional cells to include around neighborhood queries.</param>
 26    public SwiftSpatialHashOptions(int neighborhoodPadding)
 27    {
 728        if (neighborhoodPadding < 0)
 129            throw new ArgumentOutOfRangeException(nameof(neighborhoodPadding), neighborhoodPadding, "Neighborhood paddin
 30
 631        NeighborhoodPadding = neighborhoodPadding;
 632    }
 33
 34    /// <summary>
 35    /// Gets the number of extra cells queried beyond the mapped volume range when using neighborhood queries.
 36    /// </summary>
 37    public int NeighborhoodPadding { get; }
 38
 39    /// <inheritdoc />
 540    public bool Equals(SwiftSpatialHashOptions other) => NeighborhoodPadding == other.NeighborhoodPadding;
 41
 42    /// <inheritdoc />
 243    public override bool Equals(object? obj) => obj is SwiftSpatialHashOptions other && Equals(other);
 44
 45    /// <summary>
 46    /// Determines whether two SwiftSpatialHashOptions instances are equal.
 47    /// </summary>
 148    public static bool operator ==(SwiftSpatialHashOptions left, SwiftSpatialHashOptions right) => left.Equals(right);
 49
 50    /// <summary>
 51    /// Determines whether two SwiftSpatialHashOptions instances are not equal.
 52    /// </summary>
 153    public static bool operator !=(SwiftSpatialHashOptions left, SwiftSpatialHashOptions right) => !left.Equals(right);
 54
 55    /// <inheritdoc />
 256    public override int GetHashCode() => NeighborhoodPadding;
 57}