Documentatie Team
This commit is contained in:
@@ -13,13 +13,17 @@ public class Team {
|
|||||||
//===================================================================================
|
//===================================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Initialize a new team with given name and world.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name the name of the team.
|
||||||
*
|
*
|
||||||
* @post ...
|
* @post The new name of the team is equal to the given name.
|
||||||
* |setName(name)
|
* |new.getName == name
|
||||||
* @post ...
|
* @post The collection of worms in a team is a new Treeset (with TeamComparator).
|
||||||
* |wormCollection = new Treeset<>(new TeamComparator())
|
* |wormCollection = new Treeset<>(new TeamComparator())
|
||||||
|
* @post If the world is not equal to null, the team would be add to the world
|
||||||
|
* |if (world != null)
|
||||||
|
* | world.addTeam(this)
|
||||||
*/
|
*/
|
||||||
public Team (String name, World world) {
|
public Team (String name, World world) {
|
||||||
setName(name);
|
setName(name);
|
||||||
@@ -32,6 +36,17 @@ public class Team {
|
|||||||
//===================================================================================
|
//===================================================================================
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether the given object has a valid name for a object.
|
||||||
|
*
|
||||||
|
* @param obj the object to check
|
||||||
|
*
|
||||||
|
* @return True if and only if the name of the given object is not equal to the name of an other object.
|
||||||
|
* The object can only be a team.
|
||||||
|
* |if (! obj instanceof Team)
|
||||||
|
* | result == false
|
||||||
|
* |result == this.getName().equals((Team) obj).getName())
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof Team)) return false;
|
if (!(obj instanceof Team)) return false;
|
||||||
@@ -44,14 +59,15 @@ public class Team {
|
|||||||
//===================================================================================
|
//===================================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worm
|
* Adds the given worms to the team.
|
||||||
*
|
*
|
||||||
* @post ...
|
* @param worms The worms to add.
|
||||||
* |new.team = old.team + worm
|
|
||||||
*
|
*
|
||||||
|
* @post
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException Given worm is null
|
||||||
|
* |worms == null
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
* ...
|
|
||||||
* |worm == null || ! canHaveAsWorm(worm)
|
|
||||||
*/
|
*/
|
||||||
public void addWorm(Worm... worms) throws IllegalArgumentException {
|
public void addWorm(Worm... worms) throws IllegalArgumentException {
|
||||||
if (worms == null) throw new IllegalArgumentException();
|
if (worms == null) throw new IllegalArgumentException();
|
||||||
|
Reference in New Issue
Block a user