From 4f76b7305a4ffc6b574441ee3776593ad667580a Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Sun, 11 Mar 2018 18:01:43 +0100 Subject: [PATCH 1/2] commentaar createWorm --- OGP1718-Worms/src/worms/facade/Facade.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OGP1718-Worms/src/worms/facade/Facade.java b/OGP1718-Worms/src/worms/facade/Facade.java index 0372ed4..f3fa392 100644 --- a/OGP1718-Worms/src/worms/facade/Facade.java +++ b/OGP1718-Worms/src/worms/facade/Facade.java @@ -20,6 +20,11 @@ public class Facade implements IFacade { * The radius of the new worm (in meter) * @param name * the name of the new worm + * @post the new worm has the given location, direction, name and radius + * |new Worm(Tuple.create(location), direction, name, radius) + * @throws ModelException + * the location, direction, name or radius is not a valid location, direction, name or radius + * |catch(IllegalArgumentException e) */ @Override public Worm createWorm(double[] location, double direction, double radius, String name) throws ModelException { From ffb53f85da0dcb20888a3bbf547b281246a40436 Mon Sep 17 00:00:00 2001 From: Leen Dereu Date: Sun, 11 Mar 2018 19:03:31 +0100 Subject: [PATCH 2/2] commentaar Facade --- OGP1718-Worms/src/worms/facade/Facade.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/OGP1718-Worms/src/worms/facade/Facade.java b/OGP1718-Worms/src/worms/facade/Facade.java index f3fa392..2b37f7b 100644 --- a/OGP1718-Worms/src/worms/facade/Facade.java +++ b/OGP1718-Worms/src/worms/facade/Facade.java @@ -22,8 +22,8 @@ public class Facade implements IFacade { * the name of the new worm * @post the new worm has the given location, direction, name and radius * |new Worm(Tuple.create(location), direction, name, radius) - * @throws ModelException - * the location, direction, name or radius is not a valid location, direction, name or radius + * @throws ModelException(e) + * the worm throws an IllegalArgumentException * |catch(IllegalArgumentException e) */ @Override @@ -46,6 +46,11 @@ public class Facade implements IFacade { * the worm who is going to move * @param nbSteps * the number of steps the worm is going to take + * @post the worm has taken the given number of steps + * |worm.move(nbSteps) + * @throws ModelException(e) + * the worm throws an IllegalArgumentException + * |catch(IllegalArgumentException e) */ @Override public void move(Worm worm, int nbSteps) throws ModelException { @@ -64,6 +69,8 @@ public class Facade implements IFacade { * the worm who is going to move * @param angle * the angle the worm should turn + * @post the worm has turned with the given angle + * |worm.turn(angle) */ @Override public void turn(Worm worm, double angle) throws ModelException { @@ -76,6 +83,10 @@ public class Facade implements IFacade { * * @param worm * the worm who is going to move + * @post the worm has jumped + * @throws ModelException(e) + * the worm throws an IllegalStateException + * |catch(IllegalStateException e) */ @Override public void jump(Worm worm) throws ModelException { @@ -93,6 +104,9 @@ public class Facade implements IFacade { * * @param worm * the worm who is going to move + * @throws ModelException(e) + * the worm throws an IllegalStateException + * |catch(IllegalStateException e) */ @Override public double getJumpTime(Worm worm) throws ModelException { @@ -114,6 +128,9 @@ public class Facade implements IFacade { * the time the worm should jump * @return An array with two elements, with the first element being the * x-coordinate and the second element the y-coordinate. + * @throws ModelException(e) + * the worm throws an IllegalArgumentException + * |catch (IllegalArgumentException e) */ @Override public double[] getJumpStep(Worm worm, double t) throws ModelException { @@ -178,6 +195,11 @@ public class Facade implements IFacade { * the worm who is going to move * @param newRadius * the new radius of the worm + * @post the new radius is equal to the given newRadius + * |worm.setRadius(newRadius) + * @throws ModelException(e) + * the worm throws an IllegalArgumentException + * |catch(IllegalArgumentException e) */ @Override public void setRadius(Worm worm, double newRadius) throws ModelException { @@ -208,6 +230,8 @@ public class Facade implements IFacade { * the worm who is going to move * @param delta * the value that schould be decreased + * @post the action points are decreased with delta + * |worm.decreaseActionPoints((int) delta) */ @Override public void decreaseNbActionPoints(Worm worm, long delta) throws ModelException { @@ -243,6 +267,11 @@ public class Facade implements IFacade { * the worm who is going to move * @param newName * the new name for the worm + * @post the new name of the worm is equal to the given newName + * |worm.setName(newName) + * @throws ModelException(e) + * the worm throws an IllegalNameException + * |catch(IllegalNameException e) */ @Override public void rename(Worm worm, String newName) throws ModelException {