diff options
author | Camil Staps | 2015-04-18 13:44:44 +0200 |
---|---|---|
committer | Camil Staps | 2015-04-18 13:44:44 +0200 |
commit | 6a44b074f0169a1b0f9e92347af929c5e471746e (patch) | |
tree | ae5663fe7c69881bf4ecfedbef99c2505f8ec964 /Week8 Quadtrees/src/qtrees/Qtrees.java | |
parent | Added copyright to docs (diff) |
Reorganised projects
Diffstat (limited to 'Week8 Quadtrees/src/qtrees/Qtrees.java')
-rw-r--r-- | Week8 Quadtrees/src/qtrees/Qtrees.java | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Week8 Quadtrees/src/qtrees/Qtrees.java b/Week8 Quadtrees/src/qtrees/Qtrees.java new file mode 100644 index 0000000..91783f7 --- /dev/null +++ b/Week8 Quadtrees/src/qtrees/Qtrees.java @@ -0,0 +1,54 @@ +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( );
+ }
+
+}
|