rename QuadNode .forEachDirectChildNode()

This commit is contained in:
James Seibel
2023-03-25 18:44:09 -05:00
parent ba64241774
commit 3ffd4e9ff6
3 changed files with 11 additions and 11 deletions
@@ -182,7 +182,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
} }
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
recursivelyUpdateRenderSectionNode(playerPos, rootNode, quadNode, sectionPos); recursivelyUpdateRenderSectionNode(playerPos, rootNode, quadNode, sectionPos);
}); });
@@ -220,7 +220,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
} }
else else
{ {
nullableQuadNode.forEachDirectChild((childQuadNode, childSectionPosition) -> nullableQuadNode.forEachDirectChildNode((childQuadNode, childSectionPosition) ->
{ {
recursivelyUpdateRenderSectionNode(playerPos, rootNode, childQuadNode, childSectionPosition); recursivelyUpdateRenderSectionNode(playerPos, rootNode, childQuadNode, childSectionPosition);
}); });
@@ -315,7 +315,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
this.forEachRootNode((rootNode) -> this.forEachRootNode((rootNode) ->
{ {
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
if (quadNode != null && quadNode.value != null) if (quadNode != null && quadNode.value != null)
{ {
@@ -326,7 +326,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
this.forEachRootNode((rootNode) -> this.forEachRootNode((rootNode) ->
{ {
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
if (quadNode != null && quadNode.value != null) if (quadNode != null && quadNode.value != null)
{ {
@@ -415,7 +415,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
this.forEachRootNode((rootNode) -> this.forEachRootNode((rootNode) ->
{ {
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
if (quadNode != null && quadNode.value != null) if (quadNode != null && quadNode.value != null)
{ {
@@ -249,7 +249,7 @@ public class QuadNode<T>
* Applies the given consumer to all 4 of this nodes' children. <br> * Applies the given consumer to all 4 of this nodes' children. <br>
* Note: this will pass in null children. * Note: this will pass in null children.
*/ */
public void forEachDirectChild(BiConsumer<QuadNode<T>, DhSectionPos> callback) public void forEachDirectChildNode(BiConsumer<QuadNode<T>, DhSectionPos> callback)
{ {
if (this.sectionPos.sectionDetailLevel != this.minimumDetailLevel) if (this.sectionPos.sectionDetailLevel != this.minimumDetailLevel)
{ {
+5 -5
View File
@@ -448,13 +448,13 @@ public class QuadTreeTest
AtomicInteger minimumDetailLevelReachedRef = new AtomicInteger(tree.treeMaxDetailLevel); AtomicInteger minimumDetailLevelReachedRef = new AtomicInteger(tree.treeMaxDetailLevel);
tree.forEachRootNode((rootNode) -> tree.forEachRootNode((rootNode) ->
{ {
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
// all sections will be null // all sections will be null
rootNode.setValue(sectionPos, 0); rootNode.setValue(sectionPos, 0);
}); });
rootNode.forEachDirectChild((quadNode, sectionPos) -> rootNode.forEachDirectChildNode((quadNode, sectionPos) ->
{ {
recursivelyCreateNodeChildren(quadNode, tree.treeMinDetailLevel, minimumDetailLevelReachedRef); recursivelyCreateNodeChildren(quadNode, tree.treeMinDetailLevel, minimumDetailLevelReachedRef);
}); });
@@ -469,14 +469,14 @@ public class QuadTreeTest
AtomicBoolean childNodesIteratedRef = new AtomicBoolean(false); AtomicBoolean childNodesIteratedRef = new AtomicBoolean(false);
// fill in the null children // fill in the null children
node.forEachDirectChild((childNode, childSectionPos) -> node.forEachDirectChildNode((childNode, childSectionPos) ->
{ {
node.setValue(childSectionPos, 0); node.setValue(childSectionPos, 0);
childNodesCreatedRef.set(true); childNodesCreatedRef.set(true);
}); });
// attempt to recurse down these new children // attempt to recurse down these new children
node.forEachDirectChild((childNode, childSectionPos) -> node.forEachDirectChildNode((childNode, childSectionPos) ->
{ {
Assert.assertTrue("Child node recurred too low. Min detail level: "+minDetailLevel+", node detail level: "+childSectionPos.sectionDetailLevel, childSectionPos.sectionDetailLevel >= minDetailLevel); Assert.assertTrue("Child node recurred too low. Min detail level: "+minDetailLevel+", node detail level: "+childSectionPos.sectionDetailLevel, childSectionPos.sectionDetailLevel >= minDetailLevel);
recursivelyCreateNodeChildren(childNode, minDetailLevel, minimumDetailLevelReachedRef); recursivelyCreateNodeChildren(childNode, minDetailLevel, minimumDetailLevelReachedRef);
@@ -507,7 +507,7 @@ public class QuadTreeTest
public void quadNodeChildPositionIndexTest() public void quadNodeChildPositionIndexTest()
{ {
QuadNode<Integer> rootNode = new QuadNode<>(new DhSectionPos((byte)10, 0, 0), (byte)0); QuadNode<Integer> rootNode = new QuadNode<>(new DhSectionPos((byte)10, 0, 0), (byte)0);
rootNode.forEachDirectChild((child, childPos) -> rootNode.forEachDirectChildNode((child, childPos) ->
{ {
rootNode.setValue(childPos, 1); rootNode.setValue(childPos, 1);
}); });