aboutsummaryrefslogtreecommitdiff
path: root/Week8/src/qtrees/Bitmap.java
diff options
context:
space:
mode:
Diffstat (limited to 'Week8/src/qtrees/Bitmap.java')
-rw-r--r--Week8/src/qtrees/Bitmap.java73
1 files changed, 0 insertions, 73 deletions
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;
- }
-}