From d8b94f6b87bb52e96d5b54ec8e06dedcf8328e82 Mon Sep 17 00:00:00 2001 From: Valentin Boulanger Date: Sun, 22 Nov 2020 12:02:35 +0100 Subject: [PATCH] =?UTF-8?q?Impl=C3=A9mentation=20de=20la=20classe=20Projec?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppThinker/src/Project.java | 209 ++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 AppThinker/src/Project.java diff --git a/AppThinker/src/Project.java b/AppThinker/src/Project.java new file mode 100644 index 0000000..3da2958 --- /dev/null +++ b/AppThinker/src/Project.java @@ -0,0 +1,209 @@ +import java.util.ArrayList; +import java.util.List; + +/** + * Gère un projet. + * @author V.BOULANGER + */ +public class Project { + + private static int _projectId = 0; + + private int _id; + private String _name; + private String _author; + private String _version; + private String _designation; + private String _path; + + private List _classes; + private List _links; + + /** + * Crée une instance de Projet. + * @author V.BOULANGER + */ + public Project(){ + _projectId++; + _id = _projectId; + _name = "Mon super projet"; + _author = "Inconnu"; + _version = "0.0.1"; + _designation = "Projet UML AppThinker."; + _path = null; + _classes = new ArrayList(); + _links = new ArrayList(); + } + + /** + * Crée une instance de Projet avec des paramètres déterminés. + * @param name Le nom du projet. + * @param author L'auteur du projet. + * @param version La version du projet. + * @param designation L'explication du projet. + * @param path Chemin vers le ficher enregistré. + * @param classes La liste des classes du projet. + * @param links La liste des liens du projet. + * @author V.BOULANGER + */ + public Project(String name, String author, String version, String designation, String path, List classes, List links){ + _projectId++; + _id = _projectId; + _name = name; + _author = author; + _version = version; + _designation = designation; + _path = path; + _classes = classes; + _links = links; + } + + /** + * Récupère le nombre d'instances de Projet. + * @author V.BOULANGER + */ + public static int getProjectsNumber(){ + return _projectId; + } + + /** + * Récupère le numéro du Projet. + * @author V.BOULANGER + */ + public int getId(){ + return this._id; + } + + /** + * Récupère le nom du Projet. + * @author V.BOULANGER + */ + public String getName(){ + return this._name; + } + + /** + * Paramètre le nom du Projet. + * @author V.BOULANGER + */ + public void setName(String name){ + this._name = name; + } + + /** + * Récupère l'auteur du Projet. + * @author V.BOULANGER + */ + public String getAuthor(){ + return this._author; + } + + /** + * Paramètre l'auteur du Projet. + * @author V.BOULANGER + */ + public void setAuthor(String author){ + this._author = author; + } + + /** + * Récupère le numéro de version du Projet. + * @author V.BOULANGER + */ + public String getVersion(){ + return this._version; + } + + /** + * Paramètre le numéro de version du Projet. + * @author V.BOULANGER + */ + public void setVersion(String version){ + this._version = version; + } + + /** + * Récupère la désignation du Projet. + * @author V.BOULANGER + */ + public String getDesignation(){ + return this._designation; + } + + /** + * Paramètre la désignation du Projet. + * @author V.BOULANGER + */ + public void setDesignation(String designation){ + this._designation = designation; + } + + /** + * Récupère la désignation du Projet. + * @author V.BOULANGER + */ + public String getPath(){ + return this._path; + } + + /** + * Paramètre la désignation du Projet. + * @author V.BOULANGER + */ + public void setPath(String path){ + this._path = path; + } + + /** + * Ajoute une classe au projet. + * @param c La classe à ajouter. + * @author V.BOULANGER + */ + public void addClass(Class c){ + this._classes.add(c); + } + + /** + * Retire une classe du projet. + * @param index L'index de la classe à retirer. + * @author V.BOULANGER + */ + public void removeClass(int index){ + this._classes.remove(index); + } + + /** + * Supprime toutes les classes du projet. + * @author V.BOULANGER + */ + public void clearClasses(){ + this._classes.clear(); + } + + /** + * Ajoute un lien au projet. + * @param l Le lien à ajouter. + * @author V.BOULANGER + */ + public void addLink(Link l){ + this._links.add(l); + } + + /** + * Retire un lien du projet. + * @param index L'index du lien à retirer. + * @author V.BOULANGER + */ + public void removeLink(int index){ + this._links.remove(index); + } + + /** + * Supprime tous les liens du projet. + * @author V.BOULANGER + */ + public void clearLinks(){ + this._links.clear(); + } + +}