From 6a44b074f0169a1b0f9e92347af929c5e471746e Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sat, 18 Apr 2015 13:44:44 +0200 Subject: Reorganised projects --- Week8/Assignment (in Dutch).pdf | Bin 147901 -> 0 bytes Week8/Week8.tar.gz | Bin 4059 -> 0 bytes Week8/build.xml | 73 -- Week8/nbproject/build-impl.xml | 1413 ----------------------------------- Week8/nbproject/genfiles.properties | 8 - Week8/nbproject/project.properties | 72 -- Week8/nbproject/project.xml | 15 - Week8/src/qtrees/Bitmap.java | 73 -- Week8/src/qtrees/BlackLeaf.java | 13 - Week8/src/qtrees/GreyNode.java | 59 -- Week8/src/qtrees/QTNode.java | 63 -- Week8/src/qtrees/QTree.java | 102 --- Week8/src/qtrees/Qtrees.java | 54 -- Week8/src/qtrees/WhiteLeaf.java | 13 - 14 files changed, 1958 deletions(-) delete mode 100644 Week8/Assignment (in Dutch).pdf delete mode 100644 Week8/Week8.tar.gz delete mode 100644 Week8/build.xml delete mode 100644 Week8/nbproject/build-impl.xml delete mode 100644 Week8/nbproject/genfiles.properties delete mode 100644 Week8/nbproject/project.properties delete mode 100644 Week8/nbproject/project.xml delete mode 100644 Week8/src/qtrees/Bitmap.java delete mode 100644 Week8/src/qtrees/BlackLeaf.java delete mode 100644 Week8/src/qtrees/GreyNode.java delete mode 100644 Week8/src/qtrees/QTNode.java delete mode 100644 Week8/src/qtrees/QTree.java delete mode 100644 Week8/src/qtrees/Qtrees.java delete mode 100644 Week8/src/qtrees/WhiteLeaf.java (limited to 'Week8') diff --git a/Week8/Assignment (in Dutch).pdf b/Week8/Assignment (in Dutch).pdf deleted file mode 100644 index 48752d1..0000000 Binary files a/Week8/Assignment (in Dutch).pdf and /dev/null differ diff --git a/Week8/Week8.tar.gz b/Week8/Week8.tar.gz deleted file mode 100644 index 7ca3d94..0000000 Binary files a/Week8/Week8.tar.gz and /dev/null differ diff --git a/Week8/build.xml b/Week8/build.xml deleted file mode 100644 index 201f305..0000000 --- a/Week8/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project Week8. - - - diff --git a/Week8/nbproject/build-impl.xml b/Week8/nbproject/build-impl.xml deleted file mode 100644 index 4f2d68b..0000000 --- a/Week8/nbproject/build-impl.xml +++ /dev/null @@ -1,1413 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Week8/nbproject/genfiles.properties b/Week8/nbproject/genfiles.properties deleted file mode 100644 index 6c1d314..0000000 --- a/Week8/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=cc255a7c -build.xml.script.CRC32=28c657a8 -build.xml.stylesheet.CRC32=8064a381@1.75.2.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=cc255a7c -nbproject/build-impl.xml.script.CRC32=2d3c14a2 -nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 diff --git a/Week8/nbproject/project.properties b/Week8/nbproject/project.properties deleted file mode 100644 index 778b03f..0000000 --- a/Week8/nbproject/project.properties +++ /dev/null @@ -1,72 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processor.options= -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/Week8.jar -dist.javadoc.dir=${dist.dir}/javadoc -excludes= -includes=** -jar.compress=false -javac.classpath= -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.7 -javac.target=1.7 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=qtrees.Qtrees -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=true -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/Week8/nbproject/project.xml b/Week8/nbproject/project.xml deleted file mode 100644 index 75d13e1..0000000 --- a/Week8/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - Week8 - - - - - - - - - diff --git a/Week8/src/qtrees/Bitmap.java b/Week8/src/qtrees/Bitmap.java deleted file mode 100644 index 551c4c4..0000000 --- a/Week8/src/qtrees/Bitmap.java +++ /dev/null @@ -1,73 +0,0 @@ -package qtrees; - -/** - * Bitmap: A class for representing bitmap; - * @author Sjaak Smetsers - * @version 18-03-2015 - */ -public class Bitmap { - // each bit is stored into an two dimensional array - private final boolean[][] raster; - private final int bmWidth, bmHeight; - - /** - * Creates an empty bitmap of size width * height - * @param width - * @param height - */ - public Bitmap( int width, int height ) { - raster = new boolean[width][height]; - bmWidth = width; - bmHeight = height; - } - - /** - * Gets a bit at the specified position - * @param x: x coordinate - * @param y: y coordinate - */ - public boolean getBit( int x, int y ) { - return raster[x][y]; - } - - /** - * Sets a bit at the specified position - * @param x: x coordinate - * @param y: y coordinate - * @param val: the bit value - */ - public void setBit( int x, int y, boolean val ){ - raster[x][y] = val; - } - - /** - * Converts a bitmap into a string - * 1 is represented by '*'; 0 by 'O' - * @return the string representation - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - for (int y = 0; y < bmHeight; y++) { - for (int x = 0; x < bmWidth; x++) { - sb.append( raster[x][y] ? '*' : 'O' ); - } - sb.append( '\n' ); - } - return sb.toString(); - } - - /** - * @return the width of the bitmap - */ - public int getWidth() { - return bmWidth; - } - - /** - * @return the height of the bitmap - */ - public int getHeight() { - return bmHeight; - } -} diff --git a/Week8/src/qtrees/BlackLeaf.java b/Week8/src/qtrees/BlackLeaf.java deleted file mode 100644 index 0f7e71e..0000000 --- a/Week8/src/qtrees/BlackLeaf.java +++ /dev/null @@ -1,13 +0,0 @@ -package qtrees; - -/** - * @author Camil Staps, s4498062 - */ -public class BlackLeaf extends QTNode { - - public BlackLeaf () { - boolean_value = false; - string_value = "0"; - } - -} diff --git a/Week8/src/qtrees/GreyNode.java b/Week8/src/qtrees/GreyNode.java deleted file mode 100644 index 326b0af..0000000 --- a/Week8/src/qtrees/GreyNode.java +++ /dev/null @@ -1,59 +0,0 @@ -package qtrees; - -import java.io.IOException; -import java.io.Writer; - -/** - * A "grey" node (contains both black and white leaves) - * - * @author Camil Staps, s4498062 - */ -public class GreyNode extends QTNode { - - /** The four children, starting at North West, counting clockwise */ - private final QTNode children[]; - - public GreyNode() { - children = new QTNode[4]; - } - - @Override - public void fillBitmap(int x, int y, int width, Bitmap bitmap) { - children[0].fillBitmap(x, y, width / 2, bitmap); - children[1].fillBitmap(x + width / 2, y, width / 2, bitmap); - children[2].fillBitmap(x + width / 2, y + width / 2, width / 2, bitmap); - children[3].fillBitmap(x, y + width / 2, width / 2, bitmap); - } - - @Override - public void writeNode(Writer out) throws IOException { - out.write("1"); - for (QTNode child : children) - child.writeNode(out); - } - - /** - * Set one of the children nodes - * @param index the position of the child: 0 = NW; 1 = NE; 2 = SE; 3 = SW - * @param child the child node - */ - public void setChild(int index, QTNode child) { - assert (index >= 0 && index <= 3); - - children[index] = child; - } - - /** - * Compress the current node - * @return a BlackLeaf if all the children are black, a WhiteLeaf if all the - * children are white, or itself otherwise. - */ - QTNode compress() { - if (children[0].getClass() == children[1].getClass() - && children[1].getClass() == children[2].getClass() - && children[2].getClass() == children[3].getClass()) - return children[0]; - return this; - } - -} diff --git a/Week8/src/qtrees/QTNode.java b/Week8/src/qtrees/QTNode.java deleted file mode 100644 index e2ad7e5..0000000 --- a/Week8/src/qtrees/QTNode.java +++ /dev/null @@ -1,63 +0,0 @@ -package qtrees; - -import java.io.IOException; -import java.io.Writer; - -/** - * Representation of a node in a QTree - * @author Sjaak Smetsers - * @author Camil Staps, s4498062 - * - * Note: the version by Sjaak Smetsers contained a sameLeaf method. This seems to be redundant though, so I removed it. - */ -public abstract class QTNode { - protected boolean boolean_value; - protected String string_value; - - /** - * Fill a (part of a) bitmap with this node - * In the template this was an abstract method. However, then we would use - * essentially the same code in BlackLeaf and WhiteLeaf. Using a concrete - * function here that depends on static properties is much more flexible. In - * GreyNode we still override this function. - * @param x the x coordinate of the top left corner - * @param y the y coordinate of the top left corner - * @param width the width of the part of the bitmap to fill - * @param bitmap the bitmap to fill - */ - public void fillBitmap( int x, int y, int width, Bitmap bitmap ) { - int old_x = x, old_y = y; - for (; x < old_x + width; x++) - for (y = old_y; y < old_y + width; y++) - bitmap.setBit(x, y, boolean_value); - } - - /** - * Write a node as bitstream - * In the template this was an abstract method. However, then we would use - * essentially the same code in BlackLeaf and WhiteLeaf. Using a concrete - * function here that depends on static properties is much more flexible. In - * GreyNode we still override this function. - * @param out Writer to write to - * @throws IOException is passed on from Writer - */ - public void writeNode( Writer out ) throws IOException { - out.write("0" + string_value); - } - - /** - * Fill a complete area of a bitmap with a particular value - * @param x the x coordinate of the top left corner - * @param y the y coordinate of the top left corner - * @param width the width (and height) of the area to fill - * @param bitmap the bitmap to fill - * @param val the value to fill the area with - */ - public static void fillArea( int x, int y, int width, Bitmap bitmap, boolean val ){ - for (int i = 0; i < width; i++) { - for (int j = 0; j < width; j++) { - bitmap.setBit(x+i, y+j, val); - } - } - } -} diff --git a/Week8/src/qtrees/QTree.java b/Week8/src/qtrees/QTree.java deleted file mode 100644 index 24fa5e0..0000000 --- a/Week8/src/qtrees/QTree.java +++ /dev/null @@ -1,102 +0,0 @@ -package qtrees; - -import java.io.IOException; -import java.io.Reader; -import java.io.Writer; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Representation of a Quad-tree - * @author Camil Staps, s4498062 - */ -public class QTree { - /** the root of the tree */ - QTNode root; - - /** - * Construct the tree based on an ASCII representation of a bitstream on a reader - * @param input the reader - */ - public QTree( Reader input ) { - root = readQTree( input ); - } - - /** - * Construct the tree based on a bitmap - * @param bitmap the bitmap - */ - public QTree( Bitmap bitmap ) { - root = bitmap2QTree( 0, 0, bitmap.getWidth(), bitmap ); - } - - /** - * Fill a bitmap based on this tree - * @param bitmap the bitmap - */ - public void fillBitmap ( Bitmap bitmap ) { - root.fillBitmap(0, 0, bitmap.getWidth(), bitmap); - } - - /** - * Write the quad-tree as compressed bitstream - * @param sb the Writer to write to - * @throws IOException is passed on from Writer - */ - public void writeQTree( Writer sb ) throws IOException { - root.writeNode( sb ); - } - - /** - * Read a Quad-tree node based on an ASCII representation of a bitstream on a Reader - * @param input the Reader - * @return the node - */ - private static QTNode readQTree( Reader input ) { - try { - int read = input.read(); - if (read == '1') { - GreyNode node = new GreyNode(); - for (int i = 0; i < 4; i++) - node.setChild(i, readQTree(input)); - return node; - } else { - read = input.read(); - if (read == '1') { - return new WhiteLeaf(); - } else { - return new BlackLeaf(); - } - } - } catch (IOException ex) { - Logger.getLogger(QTree.class.getName()).log(Level.SEVERE, null, ex); - return null; - } - } - - /** - * Get a (compressed) node from a (part of a) bitmap - * @param x the x coordinate of the top left corner - * @param y the y coordinate of the top left corner - * @param width the width of the part to read - * @param bitmap the bitmap - * @return the (compressed) node - */ - public static QTNode bitmap2QTree( int x, int y, int width, Bitmap bitmap ) { - if (width == 1) { - if (bitmap.getBit(x,y)) { - return new WhiteLeaf(); - } else { - return new BlackLeaf(); - } - } else { - GreyNode node = new GreyNode(); - node.setChild(0, bitmap2QTree(x, y, width / 2, bitmap)); - node.setChild(1, bitmap2QTree(x + width / 2, y, width / 2, bitmap)); - node.setChild(2, bitmap2QTree(x + width / 2, y + width / 2, width / 2, bitmap)); - node.setChild(3, bitmap2QTree(x, y + width / 2, width / 2, bitmap)); - return node.compress(); - } - } - -} diff --git a/Week8/src/qtrees/Qtrees.java b/Week8/src/qtrees/Qtrees.java deleted file mode 100644 index 91783f7..0000000 --- a/Week8/src/qtrees/Qtrees.java +++ /dev/null @@ -1,54 +0,0 @@ -package qtrees; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.StringReader; -import java.io.Writer; - -/** - * Demonstration class for Quad-trees - * @author Sjaak - * @author Camil Staps, s4498062 - */ -public class Qtrees { - - /** - * Example features of the QTree: - * Constucts and outputs the same tree in all possible ways. The output should - * therefore repeat itself. - * - * @param args the command line arguments - * @throws java.io.IOException shouldn't happen with System.out anyway - */ - public static void main(String[] args) throws IOException { - // Example: reading in a bitstream - String test_tekst = "10011010001010010001010101100011000101000000"; - StringReader input = new StringReader(test_tekst); - QTree qt = new QTree( input ); - - // Example: filling a bitmap - Bitmap bitmap = new Bitmap(8, 8); - qt.fillBitmap( bitmap ); - System.out.println(bitmap); - - // Example: writing a bitstream - Writer out = new OutputStreamWriter(System.out); - qt.writeQTree(out); - out.write("\n"); - out.flush( ); - - // Example: reading a bitmap - QTree qt2 = new QTree(bitmap); - - // Example: filling a bitmap - Bitmap bm2 = new Bitmap(8,8); - qt2.fillBitmap(bm2); - System.out.println(bm2); - - // Example: writing a bitstream - qt2.writeQTree(out); - out.write("\n"); - out.flush( ); - } - -} diff --git a/Week8/src/qtrees/WhiteLeaf.java b/Week8/src/qtrees/WhiteLeaf.java deleted file mode 100644 index 57cb591..0000000 --- a/Week8/src/qtrees/WhiteLeaf.java +++ /dev/null @@ -1,13 +0,0 @@ -package qtrees; - -/** - * @author Camil Staps, s4498062 - */ -public class WhiteLeaf extends QTNode { - - public WhiteLeaf() { - boolean_value = true; - string_value = "1"; - } - -} -- cgit v1.2.3