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 ...
* |(getAllWormsOfTeam().stream().min(Comparator.comparingDouble(Worm::getMass)).orElse(null)).getMass()
* @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()
*
* @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 {
//===================================================================================
/**
* Gives the name of the team.
*
* @return ...
* @return The name of the team.
* |result == this.name
*/
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
*
* @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;
//===================================================================================