Commentaar ivm name
This commit is contained in:
@@ -287,11 +287,26 @@ public class Worm {
|
|||||||
|
|
||||||
// region name
|
// region name
|
||||||
//===================================================================================
|
//===================================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the name of the worm
|
||||||
|
* the name of the worm expresses the identity of the worm
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the name of the worm tot the given name
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the new name for the worm
|
||||||
|
* @post the new name of the worm is equal to the given name
|
||||||
|
* |new.GetName() == name
|
||||||
|
* @throws IllegalNameException(validName, name)
|
||||||
|
* the given name is not a valid name for any worm
|
||||||
|
* |! isValidName(name)
|
||||||
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
|
|
||||||
int validName = isValidName(name);
|
int validName = isValidName(name);
|
||||||
@@ -302,8 +317,17 @@ public class Worm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name ...
|
* check whether the given name is a valid name for all worms
|
||||||
* @return ...
|
*
|
||||||
|
* @param name
|
||||||
|
* the name to check
|
||||||
|
* @return -1 if and only if the given name is longer then 2,
|
||||||
|
* the first letter is uppercase and the name only exists
|
||||||
|
* of letters, " ", " ' " and " "" "
|
||||||
|
* |for (i = 0; i < name.length(); i++)
|
||||||
|
* |result == (name.length() > 2 && Character.isUpperCase(name.charAt(0)
|
||||||
|
* |&& Character.isLetter(name.charAt(i)) &&
|
||||||
|
* |allowedCharacters.indexOf(name.charAt(i)))
|
||||||
*/
|
*/
|
||||||
private int isValidName (String name) {
|
private int isValidName (String name) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user