From 0cdc9d9ca4b64c774515d00f7a8df357c3347171 Mon Sep 17 00:00:00 2001 From: SIMAILA Djalim Date: Wed, 14 Dec 2022 14:43:55 +0100 Subject: [PATCH] finished documentation for class Package --- .../java/fr/packageviewer/pack/Package.java | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/packageviewer/pack/Package.java b/src/main/java/fr/packageviewer/pack/Package.java index 0371559..db3a126 100644 --- a/src/main/java/fr/packageviewer/pack/Package.java +++ b/src/main/java/fr/packageviewer/pack/Package.java @@ -4,25 +4,67 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +/** + * The Package class stores all metadata needed for a fully completed package. + * + * @author C.Marla, R.Thomas, S.Djalim + * @version 1.0 + */ public class Package extends SearchedPackage { + /** + * List of package storing all of the dependencies of the package + */ private final List deps; + /** + * Getter for the deps attribute + * + * @return List, List of package storing all of the dependencies of the package + */ public List getDeps() { return deps; } + /** + * This method adds to the dependency list the package passed as parametter. + * + * @param pack Package, the package to add as dependency + */ public void addDep(Package pack) { deps.add(pack); } + /** + * Second constructor for the Package class, allows to create a package + * without supplying a list of dependencies. + * + * @param name String, name of the package + * @param version String, version of the package + * @param repo String, repository where the package is located + * @param description String, description of the package + */ public Package(String name, String version, String repo, String description) { this(name, version, repo, description, new ArrayList<>()); } + + /** + * Main constructor for the Package class + * + * @param name String, name of the package + * @param version String, version of the package + * @param repo String, repository where the package is located + * @param description String, description of the package + * @param deps List of Package, dependencies of the package + */ public Package(String name, String version, String repo, String description, List deps) { super(name, version, repo, description); this.deps = deps; } - + /** + * Returns a string reprensentation of the package + * + * @return String, Description of the package + */ @Override public String toString() { return "Package{%s,deps=%s}".formatted(super.toString(), deps);