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
{
/*----------------------------------------------------
------------------------------------------------------
/*----------------------------------------------------------------------------
------------------------------------------------------------------------------
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)),
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))
});
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)
{

View file

@ -6,14 +6,14 @@ public class Owner extends Directory
{
public final String name;
public final Directory parent;
public final List<Directory> children;
public final List<Directory> children;
public final List<Tree> trees;
public Owner(String name, Directory parent, List<Directory> children, List<Tree> trees)
{
this.name = name;
this.name = name;
this.parent = parent;
this.children = children;
this.trees = trees;
this.children = children;
this.trees = trees;
}
}

View file

@ -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)
{

View file

@ -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;