commentaar methodes ivm action points

This commit is contained in:
Leen Dereu
2018-03-11 16:14:28 +01:00
parent a361b4abba
commit 40e6a88c10
2 changed files with 23 additions and 17 deletions

View File

@@ -294,8 +294,6 @@ public class Worm {
return radius >= getMinRadius() && !Double.isNaN(radius);
}
/**
* Return the mass of the worm
* the mass of the worm expresses the weight of the worm
@@ -344,6 +342,10 @@ public class Worm {
return this.actionPoints;
}
/**
* Return the maximum of action points of the worm
* the maximum action points identifies the maximum energy of the worm
*/
@Basic
public long getMaxActionPoints() {
return this.maxActionPoints;
@@ -358,11 +360,11 @@ public class Worm {
* are equal to the maximum points. If the given points are lower then 0
* the current points are equal to 0. If the given points is between the
* maximum points and 0, the current points is equal to the given points
* |if (points > this.maxActionPoints)
* | actionPoints = this.maxActionPoints
* |else if (actionPoints < 0)
* | actionPoints = 0
* |this.actionPoints = actionPoints
* |if (actionPoints > getMaxActionPoints())
* | actionPoints = getMaxActionPoints();
* |else if (actionPoints < 0)
* | actionPoints = 0;
* |this.actionPoints = actionPoints;
*/
public void setActionPoints(long actionPoints) {
if (actionPoints > getMaxActionPoints())
@@ -374,8 +376,12 @@ public class Worm {
}
/**
*
* @param delta ...
*substract the current points of the worm
*
* @param delta
* the value which should be decreased
* @post the current points are set to the old current points minus the given value
* |setActionPoints(getActionPoints() - delta)
*/
public void decreaseActionPoints (long delta) {
@@ -383,12 +389,12 @@ public class Worm {
}
/**
* this variable contains the current action actionPoints of the worm
* this variable contains the current action points of the worm
*/
private long actionPoints;
/**
* this variable contains the maximum actionPoints a worm can have
* this variable contains the maximum action points a worm can have
*/
private long maxActionPoints;
@@ -398,9 +404,9 @@ public class Worm {
* @param maxActionPoints
* the new maximum of points for the worm
* @post the new maximum points is set to the given maximum points (as an integer)
* |this.maxPoints = (int) ceil(maxPoints)
* |this.maxPoints = round(maxActionPoints)
* @post when the maximum points change, the current points should change too
* |setPoints(this.points)
* |setActionPoints(getActionPoints)
*/
private void setMaxActionPoints(double maxActionPoints) {
this.maxActionPoints = round(maxActionPoints);
@@ -413,7 +419,7 @@ public class Worm {
* @param value
* the value which should be substracted
* @post the current points are set to the old current points minus the given value
* |setPoints(this.points - value)
* |setActionPoints(getActionPoints() - value)
*/
private void subtractActionPoints (long value) {
@@ -427,7 +433,7 @@ public class Worm {
* the angle needed to calculate the new current points
* @post the current points are set to the old current points minus
* the angle (in degrees) divided by 6
* |setPoints(this.points - (int) ceil(toDegrees(angle) / 6))
* |setActionPoints(getActionPoints() - (long) ceil(toDegrees(angle) / 6))
*/
private void subtractActionPoints (double angle) {

View File

@@ -1,8 +1,8 @@
* zorgen dat @invar klopt in de code
* documentatie: - Worm DONE
- Worm DONE
- getMaxActionPoints
- decreaseActionPoints
- getMaxActionPoints DONE
- decreaseActionPoints DONE
- canTurn
- Tuple (methode)
* testen schrijven