commentaar Facade

This commit is contained in:
Leen Dereu
2018-03-11 19:03:31 +01:00
parent 4f76b7305a
commit ffb53f85da

View File

@@ -22,8 +22,8 @@ public class Facade implements IFacade {
* the name of the new worm * the name of the new worm
* @post the new worm has the given location, direction, name and radius * @post the new worm has the given location, direction, name and radius
* |new Worm(Tuple.create(location), direction, name, radius) * |new Worm(Tuple.create(location), direction, name, radius)
* @throws ModelException * @throws ModelException(e)
* the location, direction, name or radius is not a valid location, direction, name or radius * the worm throws an IllegalArgumentException
* |catch(IllegalArgumentException e) * |catch(IllegalArgumentException e)
*/ */
@Override @Override
@@ -46,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 {
@@ -64,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 {
@@ -76,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 {
@@ -93,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 {
@@ -114,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 {
@@ -178,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 {
@@ -208,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 {
@@ -243,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 {