mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-08 19:19:35 +01:00
Bytter rekkefølge mellom height og width Forbedrer kommentarer Gjør slik at testene bruker Tile i stedet for TileType Legger til manglende exception i setElement til IGrid og Grid
38 lines
1.0 KiB
Java
38 lines
1.0 KiB
Java
package inf112.fiasko.roborally.objects;
|
|
|
|
/**
|
|
* This Interface describes a grid
|
|
* @param <K> The type of element the grid is to store
|
|
*/
|
|
public interface IGrid<K> {
|
|
|
|
/**
|
|
* Gets the width of the grid
|
|
* @return The width of the grid
|
|
*/
|
|
int getWidth();
|
|
|
|
/**
|
|
* Gets height of the grid
|
|
* @return The height of the grid
|
|
*/
|
|
int getHeight();
|
|
|
|
/**
|
|
* Gets the element in a given x and y coordinate
|
|
* @param x Coordinate in the grid
|
|
* @param y Coordinate in the grid
|
|
* @return Element in the x and y coordinate
|
|
* @throws IllegalArgumentException Throws an exception if the coordinates are outside of the grid
|
|
*/
|
|
K getElement(int x,int y) throws IllegalArgumentException;
|
|
|
|
/**
|
|
* Places the element on the given x and y coordinate
|
|
* @param x Coordinate in the grid
|
|
* @param y Coordinate in the grid
|
|
* @param element The element to place in the grid
|
|
*/
|
|
void setElement(int x, int y, K element) throws IllegalArgumentException;
|
|
}
|