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
|
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,28 +19,23 @@ 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
|
parseBytes(index, bytes, (a >>> 4 & 3)),
|
||||||
(
|
parseBytes(index, bytes, (a >>> 2 & 3)),
|
||||||
new Node[]
|
parseBytes(index, bytes, (a & 3)),
|
||||||
{
|
|
||||||
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 >>> 6 & 3)),
|
||||||
parseBytes(index, bytes, (b >>> 4 & 3)),
|
parseBytes(index, bytes, (b >>> 4 & 3)),
|
||||||
parseBytes(index, bytes, (b >>> 2 & 3)),
|
parseBytes(index, bytes, (b >>> 2 & 3)),
|
||||||
parseBytes(index, bytes, (b & 3))
|
parseBytes(index, bytes, (b & 3))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,14 +6,14 @@ public class Owner extends Directory
|
||||||
{
|
{
|
||||||
public final String name;
|
public final String name;
|
||||||
public final Directory parent;
|
public final Directory parent;
|
||||||
public final List<Directory> children;
|
public final List<Directory> children;
|
||||||
public final List<Tree> trees;
|
public final List<Tree> trees;
|
||||||
|
|
||||||
public Owner(String name, Directory parent, List<Directory> children, 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.parent = parent;
|
||||||
this.children = children;
|
this.children = children;
|
||||||
this.trees = trees;
|
this.trees = trees;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
parseBytes(index, bytes, (a >>> 4 & 3)),
|
||||||
(
|
parseBytes(index, bytes, (a >>> 2 & 3)),
|
||||||
new Node[]
|
parseBytes(index, bytes, (a & 3))
|
||||||
{
|
});
|
||||||
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
|
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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue