From c563fab7c18f272ab7b178e197d583fe9da84175 Mon Sep 17 00:00:00 2001 From: Petter Tobias Madsen <tobe-madsen@hotmail.no> Date: Thu, 20 Feb 2020 11:19:34 +0100 Subject: [PATCH 1/2] Tobias og Gabriel lagde en IGrid Interface --- .../roborally/element_properties/IGrid.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/java/inf112/fiasko/roborally/element_properties/IGrid.java diff --git a/src/main/java/inf112/fiasko/roborally/element_properties/IGrid.java b/src/main/java/inf112/fiasko/roborally/element_properties/IGrid.java new file mode 100644 index 0000000..29f0a4c --- /dev/null +++ b/src/main/java/inf112/fiasko/roborally/element_properties/IGrid.java @@ -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); +} From f5a9a6d42324b5cd8de66a2af8d8e80471387057 Mon Sep 17 00:00:00 2001 From: Petter Tobias Madsen <tobe-madsen@hotmail.no> Date: Thu, 20 Feb 2020 11:21:59 +0100 Subject: [PATCH 2/2] fixed issues with camel case in position test --- src/test/java/inf112/fiasko/roborally/PositionTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/inf112/fiasko/roborally/PositionTest.java b/src/test/java/inf112/fiasko/roborally/PositionTest.java index 6fe10b3..825e0c5 100644 --- a/src/test/java/inf112/fiasko/roborally/PositionTest.java +++ b/src/test/java/inf112/fiasko/roborally/PositionTest.java @@ -13,11 +13,11 @@ public class PositionTest { testPosition = new Position(3, 4); } @Test - public void TestGetXPosition(){ + public void testGetXPosition(){ assertEquals(3,testPosition.getXCoordinate()); } @Test - public void TestGetYPosition(){ + public void testGetYPosition(){ assertEquals(4,testPosition.getYCoordinate()); } }