Merge branch 'master' of gitlab.principis.be:OGP/worms

This commit is contained in:
2018-03-11 19:50:34 +01:00

View File

@@ -20,6 +20,11 @@ public class Facade implements IFacade {
* The radius of the new worm (in meter) * The radius of the new worm (in meter)
* @param name * @param name
* the name of the new worm * 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 @Override
public Worm createWorm(double[] location, double direction, double radius, String name) throws ModelException { 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 * the worm who is going to move
* @param nbSteps * @param nbSteps
* the number of steps the worm is going to take * 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 @Override
public void move(Worm worm, int nbSteps) throws ModelException { 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 * the worm who is going to move
* @param angle * @param angle
* the angle the worm should turn * the angle the worm should turn
* @post the worm has turned with the given angle
* |worm.turn(angle)
*/ */
@Override @Override
public void turn(Worm worm, double angle) throws ModelException { public void turn(Worm worm, double angle) throws ModelException {
@@ -71,6 +83,10 @@ public class Facade implements IFacade {
* *
* @param worm * @param worm
* the worm who is going to move * the worm who is going to move
* @post the worm has jumped
* @throws ModelException(e)
* the worm throws an IllegalStateException
* |catch(IllegalStateException e)
*/ */
@Override @Override
public void jump(Worm worm) throws ModelException { public void jump(Worm worm) throws ModelException {
@@ -88,6 +104,9 @@ public class Facade implements IFacade {
* *
* @param worm * @param worm
* the worm who is going to move * the worm who is going to move
* @throws ModelException(e)
* the worm throws an IllegalStateException
* |catch(IllegalStateException e)
*/ */
@Override @Override
public double getJumpTime(Worm worm) throws ModelException { public double getJumpTime(Worm worm) throws ModelException {
@@ -109,6 +128,9 @@ public class Facade implements IFacade {
* the time the worm should jump * the time the worm should jump
* @return An array with two elements, with the first element being the * @return An array with two elements, with the first element being the
* x-coordinate and the second element the y-coordinate. * x-coordinate and the second element the y-coordinate.
* @throws ModelException(e)
* the worm throws an IllegalArgumentException
* |catch (IllegalArgumentException e)
*/ */
@Override @Override
public double[] getJumpStep(Worm worm, double t) throws ModelException { 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 * the worm who is going to move
* @param newRadius * @param newRadius
* the new radius of the worm * 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 @Override
public void setRadius(Worm worm, double newRadius) throws ModelException { 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 * the worm who is going to move
* @param delta * @param delta
* the value that schould be decreased * the value that schould be decreased
* @post the action points are decreased with delta
* |worm.decreaseActionPoints((int) delta)
*/ */
@Override @Override
public void decreaseNbActionPoints(Worm worm, long delta) throws ModelException { 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 * the worm who is going to move
* @param newName * @param newName
* the new name for the worm * 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 @Override
public void rename(Worm worm, String newName) throws ModelException { public void rename(Worm worm, String newName) throws ModelException {