public class BooleanGrid2D extends AbstractGrid2D
BitSet
, i.e. each location is only one bit in
size.height, width
Constructor and Description |
---|
BooleanGrid2D(boolean[][] values)
Constructs new boolean grid by copying values from given field.
|
BooleanGrid2D(BooleanGrid2D other)
Constructs new boolean grid by copying values from other boolean grid.
|
BooleanGrid2D(int width,
int height)
Constructs new boolean grid.
|
Modifier and Type | Method and Description |
---|---|
boolean |
get(int x,
int y)
Gets the value at given coordinate.
|
void |
set(int x,
int y,
boolean value)
Sets the value at given coordinate.
|
BooleanGrid2D |
setTo(boolean value)
Sets all the locations in the grid to the provided value.
|
BooleanGrid2D |
setTo(boolean[][] field)
Sets this grid to the values from the given array.
|
boolean[][] |
toField()
Converts this grid to a two-dimensional array.
|
String |
toString() |
buildMap, buildMap, checkBounds, dlx, dly, downx, downy, drx, dry, getHeight, getHexagonalLocations, getMooreLocations, getNeighborsHamiltonianDistance, getNeighborsHexagonalDistance, getNeighborsMaxDistance, getRadialLocations, getRadialLocations, getVonNeumannLocations, getWidth, removeOrigin, removeOriginToroidal, stx, sty, trb, trt, tx, ty, ulx, uly, upx, upy, urx, ury
public BooleanGrid2D(int width, int height)
width
- height
- public BooleanGrid2D(BooleanGrid2D other)
other
- public BooleanGrid2D(boolean[][] values)
values
- the values for this gridpublic boolean get(int x, int y)
x
- the x-coordinatey
- the y-coordinatepublic void set(int x, int y, boolean value)
x
- the x-coordinatey
- the y-coordinatevalue
- the value to be set at given coordinatepublic BooleanGrid2D setTo(boolean value)
value
- the value to setpublic BooleanGrid2D setTo(boolean[][] field)
field
- a two-dimensional arraypublic boolean[][] toField()