You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/11/28 14:12:10 UTC

[commons-geometry] 02/12: Merge "if" statements.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git

commit 33a9519e433c7bd0d373f0616a734af52cbbaeef
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Nov 28 12:41:22 2019 +0100

    Merge "if" statements.
    
    Reported by "soundcloud.io".
---
 .../geometry/core/partitioning/bsp/AbstractBSPTree.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
index 3825353..b5aa0e0 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractBSPTree.java
@@ -833,14 +833,12 @@ public abstract class AbstractBSPTree<P extends Point<P>, N extends AbstractBSPT
         /** {@inheritDoc} */
         @Override
         public int depth() {
-            if (depth == UNKNOWN_VALUE) {
-                // calculate our depth based on our parent's depth, if
-                // possible
-                if (parent != null) {
-                    final int parentDepth = parent.depth();
-                    if (parentDepth != UNKNOWN_VALUE) {
-                        depth = parentDepth + 1;
-                    }
+            // Calculate our depth based on our parent's depth, if possible.
+            if (depth == UNKNOWN_VALUE &&
+                parent != null) {
+                final int parentDepth = parent.depth();
+                if (parentDepth != UNKNOWN_VALUE) {
+                    depth = parentDepth + 1;
                 }
             }
             return depth;