aboutsummaryrefslogtreecommitdiff
path: root/Album.java
diff options
context:
space:
mode:
Diffstat (limited to 'Album.java')
-rw-r--r--Album.java137
1 files changed, 133 insertions, 4 deletions
diff --git a/Album.java b/Album.java
index e457e72..71bf0d7 100644
--- a/Album.java
+++ b/Album.java
@@ -1,6 +1,26 @@
+/*
+ * Name : Album
+ *
+ * Description : The Album class is used to create albums containing songs added after its creation and the creation of the songs
+ *
+ * Version : 1.0
+ *
+ * Date : 28/12/2020
+ *
+ * Copyright : Aimeric ADJUTOR
+ */
+
import java.util.*;
import java.io.Serializable;
+/**
+ * The album class is used to create albums containing songs added after its creation and the creation of the songs.
+ *
+ * @version 1.0
+ *
+ * @author Aimeric ADJUTOR
+ */
+
public class Album implements Serializable {
private static final long serialVersionUID = -8678385322105507976L;
@@ -9,6 +29,19 @@ public class Album implements Serializable {
private String title, artist;
private ArrayList<Song> songs = new ArrayList<Song>();
+/**
+ * Constructor method.
+ *
+ * @param title String
+ * @param duration int, calculated with the actual duration of the object's songs
+ * @param artist String
+ * @param date Date
+ * @param songs ArrayList
+ *
+ * @see MusicalElement
+ *
+ * @author Aimeric ADJUTOR
+ * */
public Album(String title, int duration, String artist, Date date, ArrayList<Song> songs) {
this.title=title;
this.duration=this.getDuration();
@@ -16,16 +49,55 @@ public class Album implements Serializable {
this.date=date;
this.songs=songs;
}
-
+/**
+ * This method is used to give the id of the album.
+ *
+ * @return It returns the id, which is an int.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public int getId(){return id;}
+
+/**
+ * This method is used to give the title of the album.
+ *
+ * @return It returns the title, which is a String.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public String getTitle(){return title;}
+/**
+ * This method is used to give the duration of the album.
+ * It calculates it by getting the duration of each songs.
+ *
+ * @return It returns the total duration, which is an int.
+ *
+ * @see Song#getDuration
+ *
+ * @author Aimeric ADJUTOR
+ * */
public int getDuration(){
for (Song s : songs) {duration+=s.getDuration();} //increase with each song's getDuration()
return duration;
}
+/**
+ * This method is used to give the artist of the album.
+ *
+ * @return It returns the artist, which is a String.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public String getArtist(){return artist;}
+
+/**
+ * This method is used to give the date of release of the album.
+ *
+ * @return It returns the date, which is a Date.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public Date getDate(){return date;}
public void getSongs(){
for ( Song s : songs ){
@@ -33,21 +105,78 @@ public class Album implements Serializable {
}
}
+
+/**
+ * This method is used for the AG command in jMusicHub.
+ * It's searching for the irst song in the ArrayList songs and takes it's name.
+ *
+ * @return The genre, a Genre object, is returned.
+ *
+ * @see Song#getGenre
+ * @see jMusicHub#listAlbumsByGenre
+ *
+ * @author Aimeric ADJUTOR
+ * */
public String getGenre(){ //used for AG
Song firstSong=this.songs.get(0);
String firstSongGenre = firstSong.getGenre();
return firstSongGenre;
};
+/**
+ * Basic method to set the id of the album.
+ *
+ * @param id int
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void setId(int id){this.id=id;}
- public void setTitle(){this.title=title;}
- public void setArtist(){this.artist=artist;}
- public void setDate(){this.date=date;}
+/**
+ * Basic method to set the title of the album.
+ *
+ *@param title String
+ *
+ * @author Aimeric ADJUTOR
+ * */
+ public void setTitle(String title){this.title=title;}
+
+/**
+ * Basic method to set the artist of the album.
+ *
+ * @param artist String
+ *
+ * @author Aimeric ADJUTOR
+ * */
+ public void setArtist(String artist){this.artist=artist;}
+
+/**
+ * Basic method to set the date of the album.
+ *
+ * @param date Date
+ *
+ * @author Aimeric ADJUTOR
+ * */
+ public void setDate(Date date){this.date=date;}
+
+/**
+ * Mehtod to add songs, of the Song class, to the album's arrayList.
+ *
+ * @param song Song
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void addSong(Song song){
this.songs.add(song);
}
+/**
+ * Basic method to "configure" what does a print of this object actually does.
+ *
+ * @return String, using the object's methods
+ *
+ * @author Aimeric ADJUTOR
+ * */
public String toString() {
return "Id : "+getId()+"\nTitle : "+getTitle()+"\nDuration : "+getDuration()+"\nArtist : "+getArtist()+"\nDate of release : "+getDate();
}