|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwyvern.util.BitMatrix
A 2D array of boolean flags, implemented as a BitSet for compact storage and efficient access.
| Constructor Summary | |
BitMatrix(int width,
int height)
Constructs a new BitMatrix |
|
| Method Summary | |
void |
clear()
Resets all the values to zero (false). |
boolean |
getEntry(int x,
int y)
Returns the flag at the specified (x, y) matrix position. |
int |
getHeight()
Returns the matrix height. |
int |
getWidth()
Returns the matrix width. |
boolean |
isEmpty()
Returns true if this BitMatrix contains no bits that are set to true. |
boolean |
isEmpty(int x,
int y,
int w,
int h)
Returns true if the specified rectangle is empty. |
static void |
main(java.lang.String[] args)
Tests that it works. |
BitMatrix |
makeClone()
Clones this BitMatrix. |
void |
setEntries(int x,
int y,
int w,
int h)
Sets a rectangular area of bits in the matrix. |
void |
setEntry(int x,
int y,
boolean value)
Sets an entry at the specified (x, y) location. |
java.lang.String |
toString()
Prints out the matrix for debugging. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public BitMatrix(int width,
int height)
| Method Detail |
public void setEntry(int x,
int y,
boolean value)
x - 0-indexed x valuey - 0-indexed y value
public boolean getEntry(int x,
int y)
public void clear()
public int getWidth()
public int getHeight()
public boolean isEmpty()
public void setEntries(int x,
int y,
int w,
int h)
x - lefty - topw - widthh - height
java.lang.ArrayIndexOutOfBoundsException - if any values
are out of bounds.
public boolean isEmpty(int x,
int y,
int w,
int h)
x - left coordinate in bit-matrix spacey - top coordinate in bit-matrix spacew - width of sub-rectangle to examineh - height of sub-rectangle to examine
java.lang.ArrayIndexOutOfBoundsException - if any values
are out of bounds (but not guaranteed to be thrown, e.g.
if the entire matrix is empty.) You should do the
bounds-check up front before calling this method.public BitMatrix makeClone()
public static void main(java.lang.String[] args)
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||