formatting consistency, fixed error
This commit is contained in:
parent
f7698ab16f
commit
e17a949a53
4 changed files with 59 additions and 65 deletions
|
@ -5,11 +5,11 @@ import java.io.OutputStream;
|
|||
|
||||
public class Octree extends Tree
|
||||
{
|
||||
/*----------------------------------------------------
|
||||
------------------------------------------------------
|
||||
/*----------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
FROM BYTES
|
||||
------------------------------------------------------
|
||||
----------------------------------------------------*/
|
||||
------------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
Node parseBytes(IntReference index, byte[] bytes, int parentByte)
|
||||
{
|
||||
|
@ -19,12 +19,7 @@ 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)),
|
||||
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)),
|
||||
|
@ -36,11 +31,11 @@ public class Octree extends Tree
|
|||
});
|
||||
}
|
||||
|
||||
/*----------------------------------------------------
|
||||
------------------------------------------------------
|
||||
/*----------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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)),
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue