public class BitField extends Object
int type)
two-dimensional field of bits, initially false.
This class is not thread-safe.
| Modifier and Type | Class and Description |
|---|---|
static interface |
BitField.BitVisitor
A visitor of bits on a 2D plane.
|
| Constructor and Description |
|---|
BitField() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
get(int x,
int y)
Get a bit.
|
Rectangle |
getBoundingBox()
Get the bounding box of all the bits that are set.
|
void |
reset(int x,
int y)
Reset a bit.
|
void |
set(int x,
int y)
Set a bit.
|
boolean |
visitSetBits(BitField.BitVisitor visitor)
Perform a task for all bits that are set.
|
public void set(int x,
int y)
x - The X coordinate of the bit to set.y - The Y coordinate of the bit to set.public void reset(int x,
int y)
x - The X coordinate of the bit to reset.y - The Y coordinate of the bit to reset.public boolean get(int x,
int y)
x - The X coordinate of the bit to get.y - The Y coordinate of the bit to get.true if the bit is set, false
otherwise.public Rectangle getBoundingBox()
null if no bits are set.public boolean visitSetBits(BitField.BitVisitor visitor)
visitor - The task to perform.true if the visitor returned true for
every bit and every bit was therefore visited. false if the
visitor returned false for some bit and not all bits may
have been visited.Copyright © 2011–2025 pepsoft.org. All rights reserved.