diff --git a/OGP1718-Worms/src/worms/model/Team.java b/OGP1718-Worms/src/worms/model/Team.java index 8ad7e56..3896fb5 100644 --- a/OGP1718-Worms/src/worms/model/Team.java +++ b/OGP1718-Worms/src/worms/model/Team.java @@ -229,13 +229,14 @@ public class Team { //=================================================================================== /** + * Gives the minimum mass of the worms of the team. + * + * @return The worm with the lowest mass of all the worms of the team. + * |Worm minMass = this.wormCollection.stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null) + * |result == minMass.getMass() * - * @return ... - * |(getAllWormsOfTeam().stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null)).getMass() - * - * @throws IllegalStateException - * ... - * |minMass == null + * @throws IllegalStateException If the minimum mass is equal to null. + * |minMass == null */ private double getMinMassTeam() throws IllegalStateException { Worm minMass = this.wormCollection.stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null); @@ -254,8 +255,9 @@ public class Team { //=================================================================================== /** - * - * @return ... + * Gives the name of the team. + * + * @return The name of the team. * |result == this.name */ public String getName() { @@ -263,15 +265,17 @@ public class Team { } /** - * - * @param name - * - * @post ... + * Sets the name of the team to the given name. + * + * @param name The new name of the team. + * + * @post The new name is a valid team name. (If validTeamName is equal to -1) + * |int validTeamName = Worm.isValidName(name); + * @post The new name is equal to the given name. * |new.getName() == name * - * @throws IllegalNameException - * ... - * |Worm.isValidName(name) != -1 + * @throws IllegalNameException If the validTeamName does not equal with -1 + * |Worm.isValidName(name) != -1 */ public void setName(String name) throws IllegalNameException { @@ -282,9 +286,6 @@ public class Team { this.name = name; } - /** - * - */ private String name; //=================================================================================== @@ -295,8 +296,12 @@ public class Team { //=================================================================================== /** - * @post ... - * |new.terminatd = true + * Terminates the team + * + * @post The worms of the team are removed from the team. + * |removeWormsFromTeam(this.wormCollection.toArray(new Worm[0])) + * @post The variable terminated is set to true. + * |new.terminated = true */ public void terminate() { @@ -306,17 +311,15 @@ public class Team { } /** - * - * @return ... + * Checks of the team is terminated. + * + * @return Of the team is terminated or not * |result == this.terminated */ public boolean isTerminated() { return this.terminated; } - - /** - * - */ + private boolean terminated = false; //===================================================================================