blob: 91783f7304120a4267590c4a9992bd318f8c4e74 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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( );
}
}
|