This commit is contained in:
2018-03-11 21:41:12 +01:00
parent e99123fb7c
commit 6a329e4533
2 changed files with 8 additions and 10 deletions

View File

@@ -22,7 +22,7 @@ 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(e) * @throws ModelException
* the worm throws an IllegalArgumentException * the worm throws an IllegalArgumentException
* |catch(IllegalArgumentException e) * |catch(IllegalArgumentException e)
*/ */
@@ -35,8 +35,6 @@ public class Facade implements IFacade {
catch(IllegalArgumentException e) { catch(IllegalArgumentException e) {
throw new ModelException(e); throw new ModelException(e);
} }
} }
/** /**
@@ -48,7 +46,7 @@ public class Facade implements IFacade {
* 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 * @post the worm has taken the given number of steps
* |worm.move(nbSteps) * |worm.move(nbSteps)
* @throws ModelException(e) * @throws ModelException
* the worm throws an IllegalArgumentException * the worm throws an IllegalArgumentException
* |catch(IllegalArgumentException e) * |catch(IllegalArgumentException e)
*/ */
@@ -84,7 +82,7 @@ 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 * @post the worm has jumped
* @throws ModelException(e) * @throws ModelException
* the worm throws an IllegalStateException * the worm throws an IllegalStateException
* |catch(IllegalStateException e) * |catch(IllegalStateException e)
*/ */
@@ -104,7 +102,7 @@ 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) * @throws ModelException
* the worm throws an IllegalStateException * the worm throws an IllegalStateException
* |catch(IllegalStateException e) * |catch(IllegalStateException e)
*/ */
@@ -128,7 +126,7 @@ 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) * @throws ModelException
* the worm throws an IllegalArgumentException * the worm throws an IllegalArgumentException
* |catch (IllegalArgumentException e) * |catch (IllegalArgumentException e)
*/ */
@@ -197,7 +195,7 @@ public class Facade implements IFacade {
* the new radius of the worm * the new radius of the worm
* @post the new radius is equal to the given newRadius * @post the new radius is equal to the given newRadius
* |worm.setRadius(newRadius) * |worm.setRadius(newRadius)
* @throws ModelException(e) * @throws ModelException
* the worm throws an IllegalArgumentException * the worm throws an IllegalArgumentException
* |catch(IllegalArgumentException e) * |catch(IllegalArgumentException e)
*/ */
@@ -269,7 +267,7 @@ public class Facade implements IFacade {
* 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 * @post the new name of the worm is equal to the given newName
* |worm.setName(newName) * |worm.setName(newName)
* @throws ModelException(e) * @throws ModelException
* the worm throws an IllegalNameException * the worm throws an IllegalNameException
* |catch(IllegalNameException e) * |catch(IllegalNameException e)
*/ */

View File

@@ -72,7 +72,7 @@ public class Tuple<T1, T2> {
* | arr == null || arr.length != 2 * | arr == null || arr.length != 2
*/ */
@Immutable @Immutable
public static <T1> Tuple<T1, T1> create(T1[] arr) throws IllegalArgumentException { public static Tuple<Double, Double> create(double[] arr) throws IllegalArgumentException {
if (arr == null || arr.length != 2) if (arr == null || arr.length != 2)
throw new IllegalArgumentException("Invalid parameter arr"); throw new IllegalArgumentException("Invalid parameter arr");
return new Tuple<>(arr[0], arr[1]); return new Tuple<>(arr[0], arr[1]);