From 5921c430badc609d16e85ba006de6616e8d89931 Mon Sep 17 00:00:00 2001 From: Corentin LEMAIRE Date: Fri, 9 Jun 2023 14:58:13 +0200 Subject: [PATCH] Add some comments --- Sources/Model/Album.cs | 27 ++++++++++++++++++--------- Sources/Model/Artist.cs | 17 +++++++++++++++++ Sources/Model/CustomTitle.cs | 25 +++++++++++++++++++++++-- Sources/Model/Genre.cs | 3 +++ Sources/Model/InfoTitle.cs | 19 ++++++++++++++++++- Sources/Model/Playlist.cs | 19 ++++++++++++++++++- Sources/Model/Title.cs | 18 +++++++++++++++++- 7 files changed, 114 insertions(+), 14 deletions(-) diff --git a/Sources/Model/Album.cs b/Sources/Model/Album.cs index 0a03713..e3ccef9 100644 --- a/Sources/Model/Album.cs +++ b/Sources/Model/Album.cs @@ -7,6 +7,7 @@ namespace Model /// /// Classe Album /// + public class Album { private static long nbAlbum = 0; @@ -100,9 +101,14 @@ namespace Model private ObservableCollection infoTitles = new ObservableCollection(); - /// - /// Constructeur de la classe album - /// + /** + * \brief Constructeur de la classe album + * \param[in] name Nom de l'album + * \param[in] imageURL Chemin d'accès de l'image d'un album + * \param[in] artist Artiste de l'album + * \param[in] description Description de l'album + * \param[in] information Informations complémentaires sur un album + */ public Album(string name, string imageURL, Artist artist, string description, string information) { id = nbAlbum; @@ -121,18 +127,20 @@ namespace Model { Artist = new Artist(Manager.DEFAULT_NAME); } + /// /// Permet d'ajouter l'InfoTitle passé en paramètre à la liste /// - /// + /// Titre à rajouter à l'album public void AddTitle(InfoTitle title) { infoTitles.Add(title); } + /// /// Permet de supprimer l'InfoTitle passé en paramètre si il est présent dans la liste /// - /// + /// Titre à supprimer de l'album public void RemoveTitle(InfoTitle title) { infoTitles.Remove(title); @@ -141,7 +149,7 @@ namespace Model /// /// Fonction qui permet de déterminer si deux objets Album sont égaux /// - /// + /// Objet comparé à l'album actuel /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { @@ -150,19 +158,20 @@ namespace Model if (obj is Album album && Name == album.Name) return true; else return false; } + /// /// Permet de déterminer le hash d'un objet Album /// - /// hash de l'attribut ImageURL + /// Hash de l'attribut Name public override int GetHashCode() { - return ImageURL.GetHashCode(); + return Name.GetHashCode(); } /// /// Permet de convertir un objet Album en string /// - /// une nouvelle chaîne caractères contenant le nom de l'album et le nom de l'artiste + /// Une nouvelle chaîne caractères contenant le nom de l'Album et le nom de l'Artist public override string ToString() { return $"Name : {Name}, Artist : {Artist}"; diff --git a/Sources/Model/Artist.cs b/Sources/Model/Artist.cs index a97b7fe..c46d630 100644 --- a/Sources/Model/Artist.cs +++ b/Sources/Model/Artist.cs @@ -5,6 +5,10 @@ namespace Model; public class Artist { + /// + /// Classe Artist + /// + public string Name { get => name; @@ -30,6 +34,11 @@ public class Artist } + /// + /// Fonction qui permet de déterminer si deux objets Artist sont égaux + /// + /// + /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { if(obj == null) return false; @@ -38,11 +47,19 @@ public class Artist else return false; } + /// + /// Permet de déterminer le hash d'un objet Artist + /// + /// Hash de l'attribut Name public override int GetHashCode() { return Name.GetHashCode(); } + /// + /// Permet de convertir un objet Artist en string + /// + /// Une nouvelle chaîne caractères contenant le nom de l'Artist public override string ToString() { return $"{Name}"; diff --git a/Sources/Model/CustomTitle.cs b/Sources/Model/CustomTitle.cs index a940115..c33923a 100644 --- a/Sources/Model/CustomTitle.cs +++ b/Sources/Model/CustomTitle.cs @@ -6,7 +6,10 @@ namespace Model; public class CustomTitle : Title, INotifyPropertyChanged { - + /// + /// Classe CustomTitle + /// + public string Path { get => path; @@ -75,9 +78,19 @@ public class CustomTitle : Title, INotifyPropertyChanged public CustomTitle() : base(Manager.DEFAULT_NAME, Manager.DEFAULT_URL, Manager.DEFAULT_DESC) { } + /// + /// Fonction qui permet de déterminer si deux objets CustomTitle sont égaux selon leurs chemin d'accès + /// + /// + /// Un booléen indiquant si les chemins d'accès sont égaux public bool Equals(CustomTitle other) => Path.Equals(other?.Path); + /// + /// Fonction qui permet de déterminer si deux objets CustomTitle sont égaux + /// + /// + /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { if (ReferenceEquals(obj, null)) return false; @@ -86,11 +99,19 @@ public class CustomTitle : Title, INotifyPropertyChanged return Equals(obj as CustomTitle); } + /// + /// Permet de déterminer le hash d'un objet CustomTitle + /// + /// Hash de l'attribut Path public override int GetHashCode() { - return ImageURL.GetHashCode(); + return Path.GetHashCode(); } + /// + /// Permet de convertir un objet CustomTitle en string + /// + /// Une nouvelle chaîne caractères contenant le nom du CustomTitle et le chemin d'accès public override string ToString() { return $"Name : {Name}, Path : {Path}"; diff --git a/Sources/Model/Genre.cs b/Sources/Model/Genre.cs index f0aec92..d2be539 100644 --- a/Sources/Model/Genre.cs +++ b/Sources/Model/Genre.cs @@ -2,6 +2,9 @@ public enum Genre { + /// + /// Enum des diffénres genres référencés. + /// HIP_HOP, POP, ROCK, ELECTRO, CLASSIQUE, JAZZ, VARIETE_FRANCAISE, VARIETE_INTERNATIONALE, REGGAE, RAP, RNB, DISCO, BLUES, COUNTRY, FUNK, GOSPEL, METAL, K_POP } diff --git a/Sources/Model/InfoTitle.cs b/Sources/Model/InfoTitle.cs index fd4ea14..c3caff4 100644 --- a/Sources/Model/InfoTitle.cs +++ b/Sources/Model/InfoTitle.cs @@ -5,6 +5,10 @@ namespace Model; public class InfoTitle : Title { + /// + /// Classe InfoTitle + /// + public string Description { get => description; @@ -67,6 +71,11 @@ public class InfoTitle : Title } } + /// + /// Fonction qui permet de déterminer si deux objets InfoTitle sont égaux + /// + /// + /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { if (obj is null) return false; @@ -75,11 +84,19 @@ public class InfoTitle : Title else return false; } + /// + /// Permet de déterminer le hash d'un objet InfoTitle + /// + /// Hash de l'attribut Name public override int GetHashCode() { - return ImageURL.GetHashCode(); + return Name.GetHashCode(); } + /// + /// Permet de convertir un objet InfoTitle en string + /// + /// Une nouvelle chaîne caractères contenant le nom de l'InfoTitle et le chemin d'accès à l'image public override string ToString() { return $"Name : {Name}, ImageUrl : {ImageURL}"; diff --git a/Sources/Model/Playlist.cs b/Sources/Model/Playlist.cs index 1aa251b..7f2a74b 100644 --- a/Sources/Model/Playlist.cs +++ b/Sources/Model/Playlist.cs @@ -8,6 +8,10 @@ namespace Model; public class Playlist : INotifyPropertyChanged { + /// + /// Classe Playlist + /// + public event PropertyChangedEventHandler PropertyChanged; public string Name @@ -214,6 +218,11 @@ public class Playlist : INotifyPropertyChanged } + /// + /// Fonction qui permet de déterminer si deux objets Playlist sont égaux + /// + /// + /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { if (obj is null) return false; @@ -222,11 +231,19 @@ public class Playlist : INotifyPropertyChanged else return false; } + /// + /// Permet de déterminer le hash d'un objet Playlist + /// + /// Hash de l'attribut Name public override int GetHashCode() { - return ImageURL.GetHashCode(); + return Name.GetHashCode(); } + /// + /// Permet de convertir un objet Playlist en string + /// + /// Une nouvelle chaîne caractères contenant le nom de la Playlist public override string ToString() { return $"Name : {Name}"; diff --git a/Sources/Model/Title.cs b/Sources/Model/Title.cs index bd977e6..673e60b 100644 --- a/Sources/Model/Title.cs +++ b/Sources/Model/Title.cs @@ -7,6 +7,9 @@ namespace Model; public class Title { + /// + /// Classe Title + /// public event PropertyChangedEventHandler PropertyChanged; @@ -71,6 +74,11 @@ public class Title Information = informations; } + /// + /// Fonction qui permet de déterminer si deux objets Title sont égaux + /// + /// + /// Un booléen indiquant si l'objet est égal public override bool Equals(object obj) { if (obj is null) return false; @@ -79,11 +87,19 @@ public class Title else return false; } + /// + /// Permet de déterminer le hash d'un objet Title + /// + /// Hash de l'attribut Name public override int GetHashCode() { - return ImageURL.GetHashCode(); + return Name.GetHashCode(); } + /// + /// Permet de convertir un objet Title en string + /// + /// Une nouvelle chaîne caractères contenant le nom du Title public override string ToString() { return $"Name : {Name}";