From b11d1c4b3e089fccdbd8646bf3c57091b30e4c28 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 8 Apr 2023 10:21:03 -0500 Subject: [PATCH] Improve QuadNode.getChildValueCount() --- .../seibel/lod/core/util/objects/quadTree/QuadNode.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/seibel/lod/core/util/objects/quadTree/QuadNode.java b/core/src/main/java/com/seibel/lod/core/util/objects/quadTree/QuadNode.java index f0e954bb0..ea5b8523d 100644 --- a/core/src/main/java/com/seibel/lod/core/util/objects/quadTree/QuadNode.java +++ b/core/src/main/java/com/seibel/lod/core/util/objects/quadTree/QuadNode.java @@ -56,7 +56,10 @@ public class QuadNode - /** @return the number of non-null child nodes */ + /** + * Use {@link QuadNode#getChildValueCount()} if you want the number of non-null child values. + * @return the number of non-null child nodes + */ public int getChildCount() { int count = 0; @@ -70,14 +73,14 @@ public class QuadNode return count; } - /** returns the number of children that have non-null values */ + /** @return the number of children that have non-null values */ public int getChildValueCount() { int count = 0; for (int i = 0; i < 4; i++) { QuadNode child = this.getChildByIndex(i); - if (child != null && child.value != null) + if (child != null && (child.value != null || child.getChildValueCount() != 0)) { count++; }