From e17a949a5357dd90eb64ef7d0db9b8a4e1e13570 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 9 Jan 2017 01:30:20 -0500 Subject: [PATCH] formatting consistency, fixed error --- src/regions/Octree.java | 51 ++++++++++++++++++--------------------- src/regions/Owner.java | 8 +++--- src/regions/Quadtree.java | 41 +++++++++++++++---------------- src/regions/Tree.java | 24 +++++++++--------- 4 files changed, 59 insertions(+), 65 deletions(-) diff --git a/src/regions/Octree.java b/src/regions/Octree.java index 8b261ce..b46dd9d 100644 --- a/src/regions/Octree.java +++ b/src/regions/Octree.java @@ -5,11 +5,11 @@ import java.io.OutputStream; public class Octree extends Tree { - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ FROM BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ Node parseBytes(IntReference index, byte[] bytes, int parentByte) { @@ -19,28 +19,23 @@ public class Octree extends Tree byte a = bytes[index.ref++], b = bytes[index.ref++]; - return - new Node - ( - new Node[] - { - parseBytes(index, bytes, (a >>> 6 & 3)), - parseBytes(index, bytes, (a >>> 4 & 3)), - parseBytes(index, bytes, (a >>> 2 & 3)), - parseBytes(index, bytes, (a & 3)), - - parseBytes(index, bytes, (b >>> 6 & 3)), - parseBytes(index, bytes, (b >>> 4 & 3)), - parseBytes(index, bytes, (b >>> 2 & 3)), - parseBytes(index, bytes, (b & 3)) - }); + return new Node( new Node[] { parseBytes(index, bytes, (a >>> 6 & 3)), + parseBytes(index, bytes, (a >>> 4 & 3)), + parseBytes(index, bytes, (a >>> 2 & 3)), + parseBytes(index, bytes, (a & 3)), + + parseBytes(index, bytes, (b >>> 6 & 3)), + parseBytes(index, bytes, (b >>> 4 & 3)), + parseBytes(index, bytes, (b >>> 2 & 3)), + parseBytes(index, bytes, (b & 3)) + }); } - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ TO BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ public void writeBytes(Node node, OutputStream output) { @@ -59,15 +54,17 @@ public class Octree extends Tree )); } catch (IOException e) { e.printStackTrace(); } + for (Node child : node.children) + if (child.children.length > 0) writeBytes(child, output); } - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ CONSTRUCTORS - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ public Octree(Owner owner, byte[] bytes) { diff --git a/src/regions/Owner.java b/src/regions/Owner.java index 24f3f90..4cd1c0a 100644 --- a/src/regions/Owner.java +++ b/src/regions/Owner.java @@ -6,14 +6,14 @@ public class Owner extends Directory { public final String name; public final Directory parent; - public final List children; + public final List children; public final List trees; public Owner(String name, Directory parent, List children, List trees) { - this.name = name; + this.name = name; this.parent = parent; - this.children = children; - this.trees = trees; + this.children = children; + this.trees = trees; } } diff --git a/src/regions/Quadtree.java b/src/regions/Quadtree.java index b1458da..1e30f3f 100644 --- a/src/regions/Quadtree.java +++ b/src/regions/Quadtree.java @@ -5,11 +5,11 @@ import java.io.OutputStream; public class Quadtree extends Tree { - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ FROM BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ Node parseBytes(IntReference index, byte[] bytes, int parentByte) { @@ -18,23 +18,18 @@ public class Quadtree extends Tree byte a = bytes[index.ref++]; - return - new Node - ( - new Node[] - { - parseBytes(index, bytes, (a >>> 6 & 3)), - parseBytes(index, bytes, (a >>> 4 & 3)), - parseBytes(index, bytes, (a >>> 2 & 3)), - parseBytes(index, bytes, (a & 3)) - }); + return new Node( new Node[] { parseBytes(index, bytes, (a >>> 6 & 3)), + parseBytes(index, bytes, (a >>> 4 & 3)), + parseBytes(index, bytes, (a >>> 2 & 3)), + parseBytes(index, bytes, (a & 3)) + }); } - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ TO BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ public void writeBytes(Node node, OutputStream output) { @@ -47,15 +42,17 @@ public class Quadtree extends Tree )); } catch (IOException e) { e.printStackTrace(); } + for (Node child : node.children) + if (child.children.length > 0) writeBytes(child, output); } - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ CONSTRUCTORS - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ public Quadtree(Owner owner, byte[] bytes) { diff --git a/src/regions/Tree.java b/src/regions/Tree.java index 523aa86..d110e02 100644 --- a/src/regions/Tree.java +++ b/src/regions/Tree.java @@ -57,11 +57,11 @@ public abstract class Tree - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ FROM BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ /** @@ -132,11 +132,11 @@ public abstract class Tree - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ TO BYTES - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ /** @@ -231,11 +231,11 @@ public abstract class Tree - /*---------------------------------------------------- - ------------------------------------------------------ + /*---------------------------------------------------------------------------- + ------------------------------------------------------------------------------ CONSTRUCTOR - ------------------------------------------------------ - ----------------------------------------------------*/ + ------------------------------------------------------------------------------ + ----------------------------------------------------------------------------*/ public final Owner owner;