aboutsummaryrefslogtreecommitdiff
path: root/Playlist.java
diff options
context:
space:
mode:
Diffstat (limited to 'Playlist.java')
-rw-r--r--Playlist.java85
1 files changed, 84 insertions, 1 deletions
diff --git a/Playlist.java b/Playlist.java
index fc1ea94..94cfdd6 100644
--- a/Playlist.java
+++ b/Playlist.java
@@ -1,6 +1,27 @@
+/*
+ * Name : Playlist
+ *
+ * Description : The Playlist class is used to create playlists containing songs and audiobooks.
+ *
+ * Version : 1.0
+ *
+ * Date : 28/12/2020
+ *
+ * Copyright : Aimeric ADJUTOR
+ */
+
import java.util.ArrayList;
import java.io.Serializable;
+/**
+ * The Playlist class is used to create playlists containing songs and audiobooks.
+ *
+ * @version 1.0
+ * @see Song
+ * @see AudioBook
+ * @author Aimeric ADJUTOR
+ */
+
public class Playlist implements Serializable {
private static final long serialVersionUID = 6021717365357635741L;
@@ -9,19 +30,59 @@ public class Playlist implements Serializable {
private ArrayList<Song> songs = new ArrayList<Song>();
private ArrayList<AudioBook> audiobooks = new ArrayList<AudioBook>();
+/**
+ * Constructor method.
+ *
+ * @param name String
+ * @param songs ArrayList
+ * @param audiobooks ArrayList
+ *
+ * @see Song
+ * @see AudioBook
+ *
+ * @author Aimeric ADJUTOR
+ * */
public Playlist(String name, ArrayList<Song> songs, ArrayList<AudioBook> audiobooks) {
this.name=name;
this.songs=songs;
this.audiobooks=audiobooks;
}
+/**
+ * This method is used to give the id of the playlist.
+ *
+ * @return id int
+ *
+ * @author Aimeric ADJUTOR
+ * */
public int getId(){return id;}
- public String getName(){return name.toUpperCase();} //using toUpperCase method because the way I sort by name sort he upper case then the lower case, which is inconvenient.
+
+/**
+ * This method is used to give the name of the playlist in uppercase.
+ * Using toUpperCase method because the way I sort by name sorts the upper case then the lower case, which is inconvenient.
+ *
+ * @return name.toUpperCase String
+ *
+ * @author Aimeric ADJUTOR
+ * */
+ public String getName(){return name.toUpperCase();}
+
+/**
+ * This method is used to print the each songs contained in the songs attribute of the playlist.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void getSongs(){
for ( Song s : songs ){
System.out.println(s);
}
}
+
+/**
+ * This method is used to print the each audiobooks contained in the audiobooks attribute of the playlist.
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void getAudioBooks(){
for (AudioBook b : audiobooks ){
System.out.println(b);
@@ -29,9 +90,31 @@ public class Playlist implements Serializable {
}
+/**
+ * Basic method to set the id of the playlist.
+ *
+ * @param id int
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void setId(int id){this.id=id;}
+
+/**
+ * Basic method to set the name of the playlist.
+ *
+ * @param name String
+ *
+ * @author Aimeric ADJUTOR
+ * */
public void setName(String name){this.name=name;}
+/**
+ * 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()+"\nName : "+getName();
}