< Summary

Information
Class: SwiftCollections.Query.SwiftOctreeOptions
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/Octree/SwiftOctreeOptions.cs
Line coverage
100%
Covered lines: 19
Uncovered lines: 0
Coverable lines: 19
Total lines: 75
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
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%
.ctor(...)100%44100%
get_MaxDepth()100%11100%
get_NodeCapacity()100%11100%
get_EnableMergeOnRemove()100%11100%
Equals(...)100%44100%
Equals(...)100%22100%
op_Equality(...)100%11100%
op_Inequality(...)100%11100%
GetHashCode()100%11100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/Octree/SwiftOctreeOptions.cs

#LineLine coverage
 1using System;
 2
 3namespace SwiftCollections.Query;
 4
 5/// <summary>
 6/// Controls node subdivision behavior for <see cref="SwiftOctree{TKey, TVolume}"/>.
 7/// </summary>
 8public readonly struct SwiftOctreeOptions : IEquatable<SwiftOctreeOptions>
 9{
 10    /// <summary>
 11    /// Initializes a new instance of the <see cref="SwiftOctreeOptions"/> struct.
 12    /// </summary>
 13    /// <param name="maxDepth">The maximum child depth allowed below the root node.</param>
 14    /// <param name="nodeCapacity">The maximum number of entries a node should hold before attempting to split.</param>
 15    public SwiftOctreeOptions(int maxDepth, int nodeCapacity)
 4416        : this(maxDepth, nodeCapacity, true) { }
 17
 18    /// <summary>
 19    /// Initializes a new instance of the <see cref="SwiftOctreeOptions"/> struct.
 20    /// </summary>
 21    /// <param name="maxDepth">The maximum child depth allowed below the root node.</param>
 22    /// <param name="nodeCapacity">The maximum number of entries a node should hold before attempting to split.</param>
 23    /// <param name="enableMergeOnRemove">Whether empty child regions should collapse back into their parent after remov
 24    public SwiftOctreeOptions(int maxDepth, int nodeCapacity, bool enableMergeOnRemove)
 25    {
 2926        if (maxDepth < 0)
 127            throw new ArgumentOutOfRangeException(nameof(maxDepth), maxDepth, "Maximum depth must be zero or greater.");
 28
 2829        if (nodeCapacity <= 0)
 130            throw new ArgumentOutOfRangeException(nameof(nodeCapacity), nodeCapacity, "Node capacity must be greater tha
 31
 2732        MaxDepth = maxDepth;
 2733        NodeCapacity = nodeCapacity;
 2734        EnableMergeOnRemove = enableMergeOnRemove;
 2735    }
 36
 37    /// <summary>
 38    /// Gets the maximum child depth allowed below the root node.
 39    /// </summary>
 7940    public int MaxDepth { get; }
 41
 42    /// <summary>
 43    /// Gets the preferred number of entries per node before subdivision is attempted.
 44    /// </summary>
 23045    public int NodeCapacity { get; }
 46
 47    /// <summary>
 48    /// Gets a value indicating whether nodes should merge after removals leave sparse children.
 49    /// </summary>
 1550    public bool EnableMergeOnRemove { get; }
 51
 52    /// <inheritdoc />
 53    public bool Equals(SwiftOctreeOptions other)
 54    {
 755        return MaxDepth == other.MaxDepth &&
 756               NodeCapacity == other.NodeCapacity &&
 757               EnableMergeOnRemove == other.EnableMergeOnRemove;
 58    }
 59
 60    /// <inheritdoc />
 261    public override bool Equals(object? obj) => obj is SwiftOctreeOptions other && Equals(other);
 62
 63    /// <summary>
 64    /// Determines whether two SwiftOctreeOptions instances are equal.
 65    /// </summary>
 266    public static bool operator ==(SwiftOctreeOptions left, SwiftOctreeOptions right) => left.Equals(right);
 67
 68    /// <summary>
 69    /// Determines whether two SwiftOctreeOptions instances are not equal.
 70    /// </summary>
 171    public static bool operator !=(SwiftOctreeOptions left, SwiftOctreeOptions right) => !(left == right);
 72
 73    /// <inheritdoc />
 274    public override int GetHashCode() => HashCode.Combine(MaxDepth, NodeCapacity, EnableMergeOnRemove);
 75}