Documentatie Team

This commit is contained in:
Leen Dereu
2018-05-23 21:52:10 +02:00
parent b0b94ab5d6
commit b4425849b9

View File

@@ -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 ... * @throws IllegalStateException If the minimum mass is equal to null.
* |(getAllWormsOfTeam().stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null)).getMass() * |minMass == null
*
* @throws IllegalStateException
* ...
* |minMass == null
*/ */
private double getMinMassTeam() throws IllegalStateException { private double getMinMassTeam() throws IllegalStateException {
Worm minMass = this.wormCollection.stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null); Worm minMass = this.wormCollection.stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null);
@@ -254,8 +255,9 @@ public class Team {
//=================================================================================== //===================================================================================
/** /**
* * Gives the name of the team.
* @return ... *
* @return The name of the team.
* |result == this.name * |result == this.name
*/ */
public String getName() { public String getName() {
@@ -263,15 +265,17 @@ public class Team {
} }
/** /**
* * Sets the name of the team to the given name.
* @param name *
* * @param name The new name of the team.
* @post ... *
* @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 * |new.getName() == name
* *
* @throws IllegalNameException * @throws IllegalNameException If the validTeamName does not equal with -1
* ... * |Worm.isValidName(name) != -1
* |Worm.isValidName(name) != -1
*/ */
public void setName(String name) throws IllegalNameException { public void setName(String name) throws IllegalNameException {
@@ -282,9 +286,6 @@ public class Team {
this.name = name; this.name = name;
} }
/**
*
*/
private String name; private String name;
//=================================================================================== //===================================================================================
@@ -295,8 +296,12 @@ public class Team {
//=================================================================================== //===================================================================================
/** /**
* @post ... * Terminates the team
* |new.terminatd = true *
* @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() { public void terminate() {
@@ -306,17 +311,15 @@ public class Team {
} }
/** /**
* * Checks of the team is terminated.
* @return ... *
* @return Of the team is terminated or not
* |result == this.terminated * |result == this.terminated
*/ */
public boolean isTerminated() { public boolean isTerminated() {
return this.terminated; return this.terminated;
} }
/**
*
*/
private boolean terminated = false; private boolean terminated = false;
//=================================================================================== //===================================================================================