mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
3152d0cdf2
@ -0,0 +1,37 @@
|
|||||||
|
package inf112.fiasko.roborally.element_properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Interface describes a grid
|
||||||
|
* @param <K> type of element
|
||||||
|
*/
|
||||||
|
public interface IGrid<K> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the width of the grid
|
||||||
|
* @return the width
|
||||||
|
*/
|
||||||
|
int getWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the height of the grid
|
||||||
|
* @return the height
|
||||||
|
*/
|
||||||
|
int getHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns 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 exception if coordinates are not in the grid
|
||||||
|
*/
|
||||||
|
K getElement(int x,int y) throws IllegalArgumentException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* places the element in the given x and y coordinate
|
||||||
|
* @param x coordinate
|
||||||
|
* @param y coordinate
|
||||||
|
* @param element that is being placed in the grid
|
||||||
|
*/
|
||||||
|
void setElement(int x, int y, K element);
|
||||||
|
}
|
@ -13,11 +13,11 @@ public class PositionTest {
|
|||||||
testPosition = new Position(3, 4);
|
testPosition = new Position(3, 4);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void TestGetXPosition(){
|
public void testGetXPosition(){
|
||||||
assertEquals(3,testPosition.getXCoordinate());
|
assertEquals(3,testPosition.getXCoordinate());
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void TestGetYPosition(){
|
public void testGetYPosition(){
|
||||||
assertEquals(4,testPosition.getYCoordinate());
|
assertEquals(4,testPosition.getYCoordinate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user