formatting consistency, fixed error

This commit is contained in:
BuildTools 2017-01-09 01:30:20 -05:00
parent f7698ab16f
commit e17a949a53
4 changed files with 59 additions and 65 deletions

View file

@ -5,11 +5,11 @@ import java.io.OutputStream;
public class Octree extends Tree public class Octree extends Tree
{ {
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
FROM BYTES FROM BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
Node parseBytes(IntReference index, byte[] bytes, int parentByte) Node parseBytes(IntReference index, byte[] bytes, int parentByte)
{ {
@ -19,12 +19,7 @@ public class Octree extends Tree
byte a = bytes[index.ref++], byte a = bytes[index.ref++],
b = bytes[index.ref++]; b = bytes[index.ref++];
return return new Node( new Node[] { parseBytes(index, bytes, (a >>> 6 & 3)),
new Node
(
new Node[]
{
parseBytes(index, bytes, (a >>> 6 & 3)),
parseBytes(index, bytes, (a >>> 4 & 3)), parseBytes(index, bytes, (a >>> 4 & 3)),
parseBytes(index, bytes, (a >>> 2 & 3)), parseBytes(index, bytes, (a >>> 2 & 3)),
parseBytes(index, bytes, (a & 3)), parseBytes(index, bytes, (a & 3)),
@ -36,11 +31,11 @@ public class Octree extends Tree
}); });
} }
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
TO BYTES TO BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
public void writeBytes(Node node, OutputStream output) public void writeBytes(Node node, OutputStream output)
{ {
@ -59,15 +54,17 @@ public class Octree extends Tree
)); ));
} }
catch (IOException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
for (Node child : node.children) for (Node child : node.children)
if (child.children.length > 0)
writeBytes(child, output); writeBytes(child, output);
} }
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
CONSTRUCTORS CONSTRUCTORS
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
public Octree(Owner owner, byte[] bytes) public Octree(Owner owner, byte[] bytes)
{ {

View file

@ -5,11 +5,11 @@ import java.io.OutputStream;
public class Quadtree extends Tree public class Quadtree extends Tree
{ {
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
FROM BYTES FROM BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
Node parseBytes(IntReference index, byte[] bytes, int parentByte) Node parseBytes(IntReference index, byte[] bytes, int parentByte)
{ {
@ -18,23 +18,18 @@ public class Quadtree extends Tree
byte a = bytes[index.ref++]; byte a = bytes[index.ref++];
return return new Node( new Node[] { parseBytes(index, bytes, (a >>> 6 & 3)),
new Node
(
new Node[]
{
parseBytes(index, bytes, (a >>> 6 & 3)),
parseBytes(index, bytes, (a >>> 4 & 3)), parseBytes(index, bytes, (a >>> 4 & 3)),
parseBytes(index, bytes, (a >>> 2 & 3)), parseBytes(index, bytes, (a >>> 2 & 3)),
parseBytes(index, bytes, (a & 3)) parseBytes(index, bytes, (a & 3))
}); });
} }
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
TO BYTES TO BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
public void writeBytes(Node node, OutputStream output) public void writeBytes(Node node, OutputStream output)
{ {
@ -47,15 +42,17 @@ public class Quadtree extends Tree
)); ));
} }
catch (IOException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
for (Node child : node.children) for (Node child : node.children)
if (child.children.length > 0)
writeBytes(child, output); writeBytes(child, output);
} }
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
CONSTRUCTORS CONSTRUCTORS
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
public Quadtree(Owner owner, byte[] bytes) public Quadtree(Owner owner, byte[] bytes)
{ {

View file

@ -57,11 +57,11 @@ public abstract class Tree
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
FROM BYTES FROM BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
/** /**
@ -132,11 +132,11 @@ public abstract class Tree
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
TO BYTES TO BYTES
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
/** /**
@ -231,11 +231,11 @@ public abstract class Tree
/*---------------------------------------------------- /*----------------------------------------------------------------------------
------------------------------------------------------ ------------------------------------------------------------------------------
CONSTRUCTOR CONSTRUCTOR
------------------------------------------------------ ------------------------------------------------------------------------------
----------------------------------------------------*/ ----------------------------------------------------------------------------*/
public final Owner owner; public final Owner owner;