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

updated attributes, added javadocs

parent b738128e
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ import java.util.List;
public class Project {
//private HumanFace primaryFace;
private List<HumanFace> models = new ArrayList<>();
private List<HumanFace> faces = new ArrayList<>();
/**
......@@ -53,7 +53,7 @@ public class Project {
* @return list of secondary faces
*/
public List<HumanFace> getFaces() {
return Collections.unmodifiableList(models);
return Collections.unmodifiableList(faces);
}
/**
......@@ -64,17 +64,17 @@ public class Project {
* @throws IllegalArgumentException if one of faces from argument is null
*/
public void setFaces(List<HumanFace> secondaryFaces) {
this.models.clear();
this.faces.clear();
for (int i = 0; i < secondaryFaces.size(); i++) {
if (secondaryFaces.get(i) == null) {
throw new IllegalArgumentException("One of faces is null");
}
}
this.models.addAll(secondaryFaces);
this.faces.addAll(secondaryFaces);
}
/**
* Adds new face to models
* Adds new face to faces
*
* @param face HumanFace which will be added to list of secondary faces
* @throws IllegalArgumentException when argument face is null
......@@ -83,13 +83,13 @@ public class Project {
if (face == null) {
throw new IllegalArgumentException("Face is null");
}
this.models.add(face);
this.faces.add(face);
}
/**
* Removes HumanFace from models
* Removes HumanFace from faces
*
* @param face HumanFace which will be removed from models
* @param face HumanFace which will be removed from faces
* @throws IllegalArgumentException when argument face is null
*/
public void removeFace(HumanFace face) {
......@@ -97,19 +97,19 @@ public class Project {
throw new IllegalArgumentException("Face is null");
}
for (int i = 0; i < models.size(); i++) {
if (models.get(i).equals(face)) {
models.remove(i);
for (int i = 0; i < faces.size(); i++) {
if (faces.get(i).equals(face)) {
faces.remove(i);
}
}
}
/**
* Removes faces which are sent to this function by list of HumanFace
* from models
* from faces
*
* @param faces List of HumanFace faces which should be removed from
* models
* faces
*/
public void removeSelected(List<HumanFace> faces) {
for (int i = 0; i < faces.size(); i++) {
......@@ -117,8 +117,15 @@ public class Project {
}
}
/**
*
* @param name String name of the model (face)
* @return face from this project faces, if not in project than returns
* null
*/
public HumanFace getFaceByName(String name) {
for (HumanFace face : models) {
for (HumanFace face : faces) {
if (face.getShortName().equals(name)) {
return face;
}
......@@ -126,6 +133,4 @@ public class Project {
return null;
}
/* TODO implement comparable and create comparators for filtering
models */
}
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