From 7b65ab151d3eeee9f5b3fc78d9621df4f8dc450c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Kov=C3=A1r?= <matko@192.168.1.105> Date: Mon, 25 Oct 2021 11:23:14 +0200 Subject: [PATCH] updated attributes, added javadocs --- .../java/cz/fidentis/analyst/Project.java | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Comparison/src/main/java/cz/fidentis/analyst/Project.java b/Comparison/src/main/java/cz/fidentis/analyst/Project.java index 22c45df1..03de5491 100644 --- a/Comparison/src/main/java/cz/fidentis/analyst/Project.java +++ b/Comparison/src/main/java/cz/fidentis/analyst/Project.java @@ -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 */ } -- GitLab