< Summary

Information
Class: SwiftCollections.Query.SwiftBVHNode<T>
Assembly: SwiftCollections
File(s): /home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/BoundingVolume/SwiftBVHNode.cs
Line coverage
100%
Covered lines: 35
Uncovered lines: 0
Coverable lines: 35
Total lines: 103
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
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_Value()100%11100%
get_Bounds()100%11100%
get_ParentIndex()100%11100%
get_HasParent()100%11100%
get_MyIndex()100%11100%
get_LeftChildIndex()100%11100%
get_HasLeftChild()100%11100%
get_RightChildIndex()100%11100%
get_HasRightChild()100%11100%
get_HasChildren()100%22100%
get_IsLeaf()100%11100%
get_SubtreeSize()100%11100%
get_IsAllocated()100%11100%
get_Default()100%11100%
Reset()100%11100%

File(s)

/home/runner/work/SwiftCollections/SwiftCollections/src/SwiftCollections/Query/BoundingVolume/SwiftBVHNode.cs

#LineLine coverage
 1namespace SwiftCollections.Query
 2{
 3    /// <summary>
 4    /// Represents a node in a Bounding Volume Hierarchy (BVH).
 5    /// Stores spatial data and maintains hierarchical relationships.
 6    /// </summary>
 7    public struct SwiftBVHNode<T>
 8    {
 9        /// <summary>
 10        /// Gets or sets the value stored in the node.
 11        /// </summary>
 37713912        public T Value { get; set; }
 13
 14        /// <summary>
 15        /// Gets or sets the bounding volume of the node.
 16        /// </summary>
 198299817        public IBoundVolume Bounds { get; set; }
 18
 19        /// <summary>
 20        /// Gets or sets the index of the parent node.
 21        /// </summary>
 32661122        public int ParentIndex { get; set; }
 23
 24        /// <summary>
 25        /// Determines if the node has a parent.
 26        /// </summary>
 363927        public bool HasParent => ParentIndex != -1;
 28
 19651529        public int MyIndex { get; set; }
 30
 31        /// <summary>
 32        /// Gets or sets the index of the left child node.
 33        /// </summary>
 164990834        public int LeftChildIndex { get; set; }
 35
 36        /// <summary>
 37        /// Determines if the node has a left child.
 38        /// </summary>
 67648839        public bool HasLeftChild => LeftChildIndex != -1;
 40
 41        /// <summary>
 42        /// Gets or sets the index of the right child node.
 43        /// </summary>
 174939844        public int RightChildIndex { get; set; }
 45
 46        /// <summary>
 47        /// Determines if the node has a right child.
 48        /// </summary>
 69133749        public bool HasRightChild => RightChildIndex != -1;
 50
 51        /// <summary>
 52        /// Determines if the node has any children.
 53        /// </summary>
 1918654        public bool HasChildren => HasLeftChild || HasRightChild;
 55
 56        /// <summary>
 57        /// Gets or sets a value indicating whether this node is a leaf node.
 58        /// </summary>
 74003359        public bool IsLeaf { get; set; }
 60
 61        /// <summary>
 62        /// Tracks the number of nodes in the subtree rooted at this node.
 63        /// </summary>
 177079564        public int SubtreeSize { get; set; }
 65
 66        /// <summary>
 67        /// Determines whether or not this node has been allocated from the pool or is a pooled instance
 68        /// </summary>
 256438169        public bool IsAllocated { get; set; }
 70
 71        /// <summary>
 72        /// Provides a custom default instance of <see cref="SwiftBVHNode{T}"/>.
 73        /// </summary>
 282974        public static SwiftBVHNode<T> Default => new SwiftBVHNode<T>
 282975        {
 282976            Value = default,
 282977            Bounds = default,
 282978            ParentIndex = -1,
 282979            LeftChildIndex = -1,
 282980            RightChildIndex = -1,
 282981            SubtreeSize = 0,
 282982            IsLeaf = false,
 282983            IsAllocated = false
 282984        };
 85
 86        /// <summary>
 87        /// Resets the node to its default state.
 88        /// Clears all references and metadata.
 89        /// </summary>
 90        public void Reset()
 13901091        {
 13901092            Value = default;
 13901093            Bounds = default;
 13901094            IsLeaf = false;
 13901095            ParentIndex = -1;
 13901096            MyIndex = -1;
 13901097            LeftChildIndex = -1;
 13901098            RightChildIndex = -1;
 13901099            SubtreeSize = 0;
 139010100            IsAllocated = false;
 139010101        }
 102    }
 103}