diff --git a/OGP1718-Worms/src/worms/facade/Facade.java b/OGP1718-Worms/src/worms/facade/Facade.java index 0372ed4..2b37f7b 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(e) + * the worm throws an IllegalArgumentException + * |catch(IllegalArgumentException e) */ @Override public Worm createWorm(double[] location, double direction, double radius, String name) throws ModelException { @@ -41,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 { @@ -59,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 { @@ -71,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 { @@ -88,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 { @@ -109,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 { @@ -173,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 { @@ -203,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 { @@ -238,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 {