K
- The type of element the grid is to storepublic interface Grid<K>
Modifier and Type | Method and Description |
---|---|
K |
getElement(int x,
int y)
Gets the element in a given x and y coordinate
|
int |
getHeight()
Gets height of the grid
|
int |
getWidth()
Gets the width of the grid
|
void |
setElement(int x,
int y,
K element)
Places the element on the given x and y coordinate
|
int getWidth()
int getHeight()
K getElement(int x, int y) throws java.lang.IllegalArgumentException
x
- Coordinate in the gridy
- Coordinate in the gridjava.lang.IllegalArgumentException
- Throws an exception if the coordinates are outside of the gridvoid setElement(int x, int y, K element) throws java.lang.IllegalArgumentException
x
- Coordinate in the gridy
- Coordinate in the gridelement
- The element to place in the gridjava.lang.IllegalArgumentException