Skip to content
Snippets Groups Projects
Commit 477e282c authored by Matej Kovár's avatar Matej Kovár
Browse files

fixed javadocs, added checks whether method inputs are valid or not

parent 3af86a10
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,8 @@ public class Project {
/**
* Returns primary face
* @return primary face
*
* @return HumanFace primary face
*/
public HumanFace getPrimaryFace() {
return primaryFace;
......@@ -26,15 +27,21 @@ public class Project {
/**
* Sets new primary face
*
* @param primaryFace which will be new primary face
* @throws IllegalArgumentException when argument primaryFace is null
*/
public void setPrimaryFace(HumanFace primaryFace) {
if (primaryFace == null) {
throw new IllegalArgumentException("Primary face is null");
}
this.primaryFace = primaryFace;
}
/**
* returns list of HumanFace secondary faces
* @return list of secondary faces in project
* Returns list of HumanFace secondary faces
*
* @return list of secondary faces
*/
public List<HumanFace> getSecondaryFaces() {
return Collections.unmodifiableList(secondaryFaces);
......@@ -42,27 +49,45 @@ public class Project {
/**
* Sets new list of secondary faces
*
* @param secondaryFaces list of HumanFace which will be new list of
* secondary faces
* @throws IllegalArgumentException if one of faces from argument is null
*/
public void setSecondaryFaces(List<HumanFace> secondaryFaces) {
this.secondaryFaces.clear();
for (int i = 0; i < secondaryFaces.size(); i++) {
if (secondaryFaces.get(i) == null) {
throw new IllegalArgumentException("One of faces is null");
}
}
this.secondaryFaces.addAll(secondaryFaces);
}
/**
* Adds new face to secondaryFaces
*
* @param face HumanFace which will be added to list of secondary faces
* @throws IllegalArgumentException when argument face is null
*/
public void addSecondaryFace(HumanFace face) {
if (face == null) {
throw new IllegalArgumentException("Face is null");
}
this.secondaryFaces.add(face);
}
/**
* Removes HumanFace from secondaryFaces
*
* @param face HumanFace which will be removed from secondaryFaces
* @throws IllegalArgumentException when argument face is null
*/
public void removeSecondaryFace(HumanFace face) {
if (face == null) {
throw new IllegalArgumentException("Face is null");
}
for (int i = 0; i < secondaryFaces.size(); i++) {
if (secondaryFaces.get(i).equals(face)) {
secondaryFaces.remove(i);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment